Search code examples
javascriptaugmented-realityaframear.js

Not able to load obj in <a-frame> for ar.js


Not able to load obj file in following html file for ar.js despite giving the correct paths:

<script src=”https://aframe.io/releases/0.6.1/aframe.min.js"></script>
<script src=”https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"></script>

<body style=’margin : 0px; overflow: hidden;’>
  <a-scene embedded arjs=’sourceType: webcam;’>
      <a-marker preset=’hiro’>
        <!-- Adding an OBJ file to an AR Project-->
        <a-entity 
            obj-model=”obj: url(https://rishavjayswal.github.io/augmented-reality/resources/couch.obj); 
            mtl: url(https://rishavjayswal.github.io/augmented-reality/resources/couch.mtl)”>
        </a-entity>

      </a-marker>
  <a-entity camera>
  </a-entity>
  </a-scene>
</body>

Getting

GET https://rishavjayswal.github.io/augmented-reality/%E2%80%9Dhttps://aframe.io/releases/0.6.1/aframe.min.js%22 net::ERR_ABORTED

after running. Tried with relative paths for obj and mtl file also:

/resources/couch.obj

Can open the link here: https://rishavjayswal.github.io/augmented-reality/


Solution

  • Your model loads just fine. This is a working example in glitch: https://glitch.com/edit/#!/excellent-face?path=index.html:13:19

    I see you are mixing types of quotes around your attribute values. Your HTML is not valid. Use straight double quotes: "

    In your obj-model attribute you are using and in your arjs attribute you are using