Instanciate, clone and remove Mesh during runtime

Hey guys, I’m new to this and have a conceptual question.

My goal is to build a driving simulation where other cars, bicycles and pedestrians are in the scene. For these, I have .gltf models.
I need to add and remove e.g other cars at runtime. My idea was to instantiate one each and then clone appropriately. My Problem here is scope.The way I understand things, ImportMesh uses a callback to then use the object. This obviously makes sense as it needs to be loaded.

What I’m looking for is something like this: https://playground.babylonjs.com/#3YFJ5R#0
but with Meshes…

Can you please give me a hint on how to achieve this? Maybe there’s an example I missed.

Cheers

1 Like

Hi. You can use Asset Containers | Babylon.js Documentation and maybe Solid Particle System | Babylon.js Documentation

2 Likes