Load Gltf model while click on other model in Scene


I want to import the gltf model when i do right click on any models into my scene.

To achieve this i have used AssetManager in my code and try to implement with addMeshTask, but unfortunately that function itself not calling.

Can anyone please help out how to solve this?

I think you will need to call assetsManager.load() to start the loading.

can you please give me some example?

Simply add after the code you pasted above:


That will start the download. Calling addMeshTask simply add a task into the assets manager, it does not download anything.

Thank you its working now…
Is it possible to change the position of the model?

i tried to change but its not taking at all…

as you can see i try to move the object in x position but its not changing and all and i need to change the scale as well.

You should setup a repro in the Playground, it will be easier to help.

In any case, you need to wait for the mesh to be loaded to be able to move it: so your code should be in the meshTask.onSuccess callback. The meshes will be in meshTask.loadedMeshes (which is an array of mesh).

Have a look at the doc for more information about the Assets Manager: