aframegltfarchilogic

Archilogic gltf model can't be loaded in a-frame


I wrote a demo scene on glitch to test my exported gltf model in a-frame, but I am getting an error in the console:

My code

<!DOCTYPE html>
<html>
  <head>
    <title>Basic Scene - A-Frame</title>
    <meta name="description" content="Basic Scene - A-Frame">
    <script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script>
  </head>
  <body>
    <a-scene>
      <a-assets>
        <a-asset-item id="gltfDemo" src="https://cdn.glitch.com/a3c2afff-dcc6-4918-bb73-5716b35f39b0%2Fexport.gltf?1499844855169"></a-asset-item>
        <a-asset-item id="buffer_0.bin" src="https://cdn.glitch.com/a3c2afff-dcc6-4918-bb73-5716b35f39b0%2Fbuffer_0.bin?1499844851189"></a-asset-item>
        <a-asset-item id="buffer_1.bin" src="https://cdn.glitch.com/a3c2afff-dcc6-4918-bb73-5716b35f39b0%2Fbuffer_1.bin?1499844853034"></a-asset-item>
      </a-assets>
      
      <a-entity gltf-model="#gltfDemo"></a-entity>
      
      <a-sky color="#000"></a-sky>
      <a-light type="ambient" color="#445451"></a-light>
      <a-plane color="#050" rotation="-90 0 0" height="100" width="100"></a-plane>  
      <a-camera>
        <a-cursor color="#FAFAFA"></a-cursor>
      </a-camera>
    </a-scene>
  </body>
</html>

The error:

VM1762:1 Uncaught SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at e.parse (GLTFLoader.js:68)
at GLTFLoader.js:32
at three.js:29160

Source files: Glitch Fiddle with source files

I have a feeling that I am importing the gltf wrongly into glitch or using it the wrong way. Can anybody help me?


Solution

  • from what I understand Your .gltf holds references to the .bins and .jpg textures.
    Glitch is not that straightforward, and these files are not in one "directory", as You can see, when You get the links.

    The error You get is caused by aframe trying to parse a null/nonexistent source file ( bins and jpgs).


    I think it may be better if You put these files on Your server, or put it on github if You want (for the directories are straightforward).

    You can also change the file paths in the .gltf file like suggested here.