How to change 'isVisible' status of compound elements in Container?

I thought I understood the process for this already but doesn’t seem to be working:

How to set ‘isVisible = false’ for the container of everything in the following playground?

I tried "polytescontainer.isVislble = false’, and also “polytescontainer.rootContainer.isVisible = false” but neither one will clear the mesh. Using “polytescontainer” i can move the entire container so it seems I should be able to clear it too.

Any solutions are welcome.

Actually your polytescontainer is just a parent mesh (could be also a parent Transform node), not a real Babylon container as described here - Asset Containers | Babylon.js Documentation

Being the parent mesh it contains all child meshes as array. To get all children and make something with all of them there is a function getChildren()

Example - https://playground.babylonjs.com/#6H2DXU#7

polytescontainer.getChildren().forEach ((element) => element.setEnabled(false))
1 Like

Ok that works perfectly, thank you. I’ll look more carefully at the code to see the differences.

1 Like