How to load gltF assets along with .bin file and textures localy?

I loaded a glTF file for the game that I making locally on my computer. But something is not working right. Only half of the assets are loading. The textures are not loading but the scene.gltf is loading. I don’t know about the .bin file. How do I get all the files to load, and the textures to be applied to my asset?

So far the code I have is:

BABYLON.SceneLoader.ImportMesh("", 
"./", "scene.gltf", scene, function(newMeshes){
});

I have a little more more too but that is just to position it and add lights and stuff.
Please help.

Is you model loading into Sandbox correctly?
Would be nice also to have your repro in Playground, otherwise it could be very diffucult to find the problem.

1 Like

It will not work in the playground. Let me explain why. I am using external files, so I am using dropbox to host them. There is more than one file for the asset. I could just make a public folder, but that makes a new link to that folder. But you can’t use folder links, only file links, (at least not that I could find in the docs). So dropbox does not work. Because of restrictions, I can’t use github or anything like imgur. So the best option is to do it locally. :slight_smile:

Maybe you could provide .zip archive with model and all its assets?
From my point of view, Github is much more convenient than Dropbox. It is possible to put the model and all its assets in Github folder and use it at Playground.
Otherwise, having neither your model nor your code it would be difficult to point yout problem.

Here is what it is supposed to look like:


Here is what it does look like:
image

Part of the gun is missing! It did that for other models also!
Here is the zip:

I put your model into Playground - https://playground.babylonjs.com/#SYQW69#580
Added skybox for more realistic view.
As one may see, your model looks good - and even animated :slight_smile:

1 Like

So cool! Thanks so much! Can you please tell me how you did that so I can do it myself? I can use github.com, but I can not use the terminal.

1 Like

Here is the Documentation link how to use GitHub assets with Playground (it is really very simple):

But how did you upload a folder without the terminal?

OK, thank you but it does not explain how to upload a new folder. I could just make the folder, but then it prompts you to make a new file. You can’t just make a new .png file or .jpg file like you can a JavaScript file, and it won’t let you upload a picture to that folder.

Just drag and drop all your model files and Textures folder from your comp into Github folder. It will know about folders (at least it is so in my case).
Please note, that when creating a new folder at GitHub you also need to create a least some file, for example readme.md.

Your link should be https://raw.githubusercontent.com/lando19/fps-game-assets-/main/ etc
Please check your texture files.
If I put this link instead of mine (with the same model) I get errors 404 regarding textures.

OK I figured it out :slight_smile:. But how do change the mesh (scale and postion)? it is working, but it is not applying the position and scaling and stuff that it was before.

Also, it was giving a 404 error because I had not put them all in the same parent folder.

https://playground.babylonjs.com/#UKNERM#274

Use newMeshes[0] as the root node for any transformations (here scaling x.y.z *2).

Thank you so much :slight_smile:, and I know that this is really pushing it, but when I try to animate it like this:
scene.beginAnimation(skeletons[0], 0, 50, true, 1.0);
It is not working. You don’t have to answer this, it is kind of off topic, but I really thought it would work :confused:.