Loading multiple 3D models with assetmanager

I think you were getting somewhere with your previous edits.

No the models are not in the same babylon file but thanks for clarifying that too, so the way its done in your edits seems appropriate.

And I get the way with the observables but I would like to do it with the callbacks for now to understand it better.Like how would I access the loaded meshes though like I do in my onSuccess function,while using your playing ground code ?

[EDIT] https://playground.babylonjs.com/#P2EPZI#1

This is the way I access each individual mesh right now with the way you suggested. Is there any better way or am I good with this ? I mean it’s working but I wonder if there is a “standard” way.

Really thank you for replying and going through so many edits to try to find the appropriate solution.

[EDIT2] Yeah my main problem right now is how I’m going to access the imported models.

the

scene.getMeshByName(“name”)

doesn’t work even though I’m using the correct name that is confirmed by doing

console.log(game.scene.meshes)

and looking at the name of the meshes.

[EDIT3] According to this forum post : HTML5 Game Devs Forum - HTML5GameDevs.com

The proper way to access a loaded model via the assetmanager is by using the getMeshByName() function in the observables cause it’s asynchronous. Though I don’t understand why “asynchronous” make it non accessible outside of the observable it works good. I need to research it a bit.

Thanks to anyone who tried to give me pointers.

2 Likes