1

I am trying to detect different markers. One is a pattern named and1painting.patt and the other is the preset 'hiro'

When I show the hiro pattern, it is detected by the and1painting.patt marker. E.g. in the following code, it always shows the blue box rather than red, when I show the hiro marker. Thoughts on why? I tried this with the sample1.patt that is already in the repo but it didn't work either.

<!doctype HTML>
<html>
<script src="https://aframe.io/releases/0.6.1/aframe.min.js"></script>
<script src="https://cdn.rawgit.com/jeromeetienne/AR.js/1.5.0/aframe/build/aframe-ar.js"> </script>
  <body style='margin : 0px; overflow: hidden;'>
    <a-scene embedded arjs='sourceType: webcam;'>
        <a-marker type='pattern' patternUrl='Data/and1painting.patt'>
            <a-box position='0 0.5 0' material='opacity: 0.5; side:double; color:blue;'>
            </a-box>
        </a-marker>
        <!-- handle marker with hiro preset -->
        <a-marker preset='hiro'>
            <a-box position='0 0.5 0' material='opacity: 0.5; side:double; color:red;'>
            </a-box>
        </a-marker>
        <a-entity camera></a-entity>
    </a-scene>
  </body>
</html>
Bob Aleena
  • 450
  • 1
  • 6
  • 16
  • check out if the custom marker works without the hiro marker in your code, if not, try another build like i described here: https://stackoverflow.com/questions/45820170/is-it-possible-to-use-bespoke-markers – Piotr Adam Milewski Mar 03 '18 at 10:50
  • I tried it with one of the other markers that comes with AR.js -- 'sample1.patt' and it doesn't work. It only works if I use – Bob Aleena Mar 04 '18 at 05:32

2 Answers2

1

Unfortunately AR.JS still is seriously broken at the moment: https://github.com/jeromeetienne/AR.js/pull/236

You can hack your way to a working solution, if you follow the comments in the issue.

dirkk0
  • 2,460
  • 28
  • 34
  • Seems like this is it. I had assumed from the 'merged' comment that it was fixed. Perhaps needs to be forked if original dev isn't able to keep up with it. Super useful library – Bob Aleena Mar 04 '18 at 19:19
0

Actually, ar.js is not at all that broken. There is a syntax error in the code above and that is the reason it doesn't work. The correct syntax of the call for the pattern file is simply 'url = ' instead of 'patternUrl = ''.

Try this:

a-marker type='pattern' url='Data/and1painting.patt'

I know it works, because it took me forever to figure it out.