1
votes

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>
2
check out if the custom marker works without the hiro marker in your code, if not, try another build like i described here: stackoverflow.com/questions/45820170/… - Piotr Adam Milewski
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 <a-marker preset='kanji'> - Bob Aleena

2 Answers

1
votes

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.

0
votes

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.