title: How to load .glb models in a-frame?
body: <p>I am trying to load <code>.glb</code> models in a-frame using the <code>gltf-model</code> component but I get the following error;</p>
  
  <p><code>components:gltf-model:warn Unexpected token g in JSON at position 0</code></p>
  
  <p>Based on the docs <a href="https://aframe.io/docs/0.8.0/components/gltf-model.html" rel="nofollow noreferrer">here</a> and the discussion <a href="https://github.com/aframevr/aframe/issues/2420" rel="nofollow noreferrer">here</a> I believe I am doing this correctly. Please see my code below.</p>
  
  <pre><code>  &lt;a-scene&gt;
        &lt;a-assets&gt;
  
          &lt;a-asset-item 
            id="glbtestmodel"
            src="https://cdn.glitch.com/90a30469-f038-4054-be9c-fd1ec94a810d%2Fkitchentest.glb?1537178470645"&gt;
          &lt;/a-asset-item&gt;
  
        &lt;/a-assets&gt;
  
        &lt;a-entity 
            id="glbtest"
            gltf-model="#glbtestmodel"
            position="0 1 -2"&gt;
        &lt;/a-entity&gt;
  
      &lt;/a-scene&gt;
  </code></pre>
  
  <p>Using a-frame <code>8.2</code></p>
  
  <pre><code>https://aframe.io/releases/0.8.2/aframe.min.js
  </code></pre>
  
  <p>And you can see a glitch of that <a href="https://quaint-nickel.glitch.me/" rel="nofollow noreferrer">here</a>.</p>
  
  <p>I use <a href="https://www.vectary.com/" rel="nofollow noreferrer">Vectary</a> to export models, and <code>gltf</code> models exported from there always work using the same technique as expected.</p>
  
  <p>As an alternative to exporting <code>.glb</code> from vectary, I have tried exporting the models as <code>gltf</code> and then converting them using suggested tools like <a href="https://sbtron.github.io/makeglb/" rel="nofollow noreferrer">this</a> and <a href="https://glb-packer.glitch.me/" rel="nofollow noreferrer">this</a>. The result is the same.</p>
  
  <p>Every model that I export in whatever fashion, I check using <a href="https://gltf-viewer.donmccurdy.com/" rel="nofollow noreferrer">this gltf-viewer tool</a> and there are no errors. I have opened up the file and they are in <code>2.0</code> format as they should be.</p>
  
  <p>In response to the error, I have also tried opening up the <code>.glb</code> file and modifying it removing the initial characters so that it matches the beginning of a <code>gltf</code> file but it just produces different errors.</p>
  
  <p>Is this a known issue? Or am I doing something wrong?</p>
  
  <p>The model in question is available via the above code example but <a href="https://cdn.glitch.com/90a30469-f038-4054-be9c-fd1ec94a810d%2Fkitchentest.glb?1537178470645" rel="nofollow noreferrer">here is a direct link</a> for ease.</p>
  
  <p>If you need any more information from me to help advise, please let me know.</p>