Search code examples
three.jsaugmented-realityaframe

How to load obj-model using web url in aframe


I need to load .obj and .mtl files from a web URL for my Web app. But I'm not able to find a clear example. Example code would be very much appreciated.


Solution

  • From A-Frame's docs example:

     <a-scene>
      <a-assets>
        <a-asset-item id="tree-obj" src="/path/to/tree.obj"></a-asset-item>
        <a-asset-item id="tree-mtl" src="/path/to/tree.mtl"></a-asset-item>
      </a-assets>
    
      <a-entity obj-model="obj: #tree-obj; mtl: #tree-mtl"></a-entity>
    </a-scene>
    

    You can use a URL in the src.