I don't see any gltf-model or obj-model


#1

Hi!
I tried to import in the Hello, WebVR! example a 3D model. I download one without textures here: https://sketchfab.com/models/dd46764dc2bc4007b43c16cfba65c62c
The downloaded model is composed by a .gltf file and a .bin file.
I uploaded both file in the assets section on Glitch code editor.
Here my code in the editor:

<a-scene>
  
  <a-assets>
    <a-asset-item id="model" src="https://cdn.glitch.com/661f83bf-728e-4b3b-943e-85750757f2dd%2Fscene.gltf?1549639510909"></a-asset-item>
  </a-assets>
  
  <a-entity gltf-model="#model" position="0 1 0"></a-entity>
  <a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9" shadow></a-box>
  <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E" shadow></a-sphere>
  <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D" shadow></a-cylinder>
  <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4" shadow></a-plane>     
</a-scene>

But I can’t see no 3D model.
If I try it off-line, writing a .html page without tag, the .gltf and .bin file in the same directory and the tag
<a-entity gltf-model="scene.gltf" scale="0.09 0.09 0.09" position="0 3 0"></a-entity>
it works.

The same if I use a .obj model with a .mtl file.
Where is the problem on Glitch?


#2

Does it work if you have the file locally in the Glitch project? So use wget https://cdn.glitch.com/661f83bf-728e-4b3b-943e-85750757f2dd%2Fscene.gltf?1549639510909 to import it into your project and then reference the file with a relative path.


#3

I have the scene.gltf file and the scene.bin file locally in the Glitch project, I uploaded them in the assets section:

I’m a dummy user and I never use wget… how do I use it? Sorry!


#4

Uploading them to assets isn’t the same as having them locally, which is why they have a URL. In order to import them so you have them locally, open the console from the Tools menu in the bottom-left then run the wget command I provided above (copy and paste it) into the console and hit enter. Then update the src path in your html to reference the asset locally.


#5

Gareth you are very kind!
I used wget and everything went right:


But which path I must use now?
I tried witth different formats but it always gets me a blue page with three white refreshing point.

I used the Asset.js (remixing the project on https://glitch.com/edit/#!/assets-lib?path=README.md:1:0) and it doesn’t work too


#6

You’ll want to rename the file - it’s currently called ‘661f83bf-728e-4b3b-943e-85750757f2dd%2Fscene.gltf?1549639510909’. You should see it listed in your project, so click on it and rename to scene.gltf. Then referencing as you did in your local version above should work.

Assets-lib won’t help here - that just makes it so you can reference an asset with a relative path, the file still isn’t stored locally.


#7

I did it, but it doesn’t work :worried: I don’t see the 3D object:


#8

It looks like there’s a problem with that gltf file - using the same syntax with another file works fine.


#9

I tried with different gltf file, but nothing changes


#10

Perhaps looking at or remixing these examples will help:



#11

Great! Now it works! Thanks a lot!