Question about hiding components

Hello
I’ve created a simple gltf file which contains around 1000 scene nodes with each node instancing about 50 meshes - it’s the same 50 meshes for each node with a different matrix applied. This is loaded with a single LoadMeshAsync and renders fine in Bablyon.

Now I really only want one of those 50 meshes to be visible for each node at any one time - the particular mesh visible will vary by node and by user input. How can I achieve this in Babylon? I was thinking I could just use setEnable on the unwanted meshes on each node after loading my gltf but it looks like that only operates at the level of a Babylon mesh not a gltf mesh. The number of combinations is too large to allow a different mesh to be loaded for each one.

Is it possible to edit the root scene directly in javascript. I see many components in the scene object have a isVisible or isEnabled property but so far I’ve had no success with that approach. This seems like a fairly common place thing to do in configurator applications so surely there is a straightforward solution?

Thanks Des

It acts on a gltf mesh in this PG

Could you produce a simplified version of your project in a playground, one node with a couple of meshes perhaps.

You might find this useful

Thanks a lot

In the way of these things, the process of preparing some sample code exposed the (trivial) mistake I was making.

Everything works perfectly now. Just find the parent node in the scene, getChildMeshes() and then setEnabled on the children as appropriate.

Many thanks to all for the help.

Des

2 Likes