Zara Berrueta Ochoa
Zara Berrueta Ochoa

Reputation: 1

A-frame.io 3D gltf model won't load

I'm trying to load a gltf model to an a-frame , but it isn't loading. Here's the code:

<html>
 <head>
   <title>Tree model</title>
   <script src="https://aframe.io/releases/0.7.1/aframe.min.js"></script>
 
  </head>
  <body>
    <a-scene>
      <a-assets id="#tree" src="tree-assets/tree01.gltf">
    
      </a-assets>
      <a-entity gltf-model="#tree"></a-entity>
    </a-scene>
  </body>
</html>

Upvotes: 0

Views: 196

Answers (1)

kaitlingm
kaitlingm

Reputation: 11

When you give an item an id you don't need to give it a hash tag. Also, try giving the model a position, they default to position 0 0 0, which sometimes you're unable to see as its inside of the camera. Also try using the latest version of A-frame

Try this:

 <html>
  <head>
   <title>Tree model</title>
    <script src="https://aframe.io/releases/1.1.0/aframe.min.js"></script>

 </head>
 <body>
  <a-scene>
   <a-assets id="tree" src="tree-assets/tree01.gltf"></a-assets>
   <a-entity gltf-model="#tree" position="0 2 -2"></a-entity>
  </a-scene>
 </body>
</html> 

Hope this helped :)

Upvotes: 1

Related Questions