My pleasure, thanks for the returned kindness… nice of ya.
I think that depends-upon many factors, like how often you need to add/remove boxes from the group, and how “clustered” the group will be, etc. We have a mergeMeshes feature… but after the merge, the meshes cannot be re-separated. BUT, you CAN maintain a group in 2 forms… the separated version, and the merged version.
Without knowing your project, it is difficult to determine more-efficient ways.
After a group of mesh are merged… then yes, it is treated as a single mesh… easy to highlight or glow. But merged groups have limits… such as… difficult to drag/drop children to different positions/rotations within the group. I don’t know if you will ever need to do that, or not.
https://doc.babylonjs.com/how_to/how_to_merge_meshes
Playground search for mergeMeshes: Playground search page | Babylon.js Documentation
It might be worth examining and testing. shrug
There might be a solution with Babylon’s SPS system, too. It is a “solid particle system” that “digests” mesh primitives such as boxes, and then the SPS.mesh is treated like a single mesh, even though its .particles array contains many boxes (or other mesh shapes).
Example: https://playground.babylonjs.com/#LXXL6Y#13
Many boxes, as particles. BUT… as you can see in lines 64-68, I am failing to get the solid particle system ‘mesh’ to use glow. Glow uses mesh.material.emissiveColor… and I don’t know how to activate a standardMaterial.emissiveColor on each SPS box-particle. I would need to experiment.
An SPS “central mesh” might never be able to be glowed or highlighted… due to what it is. Not sure. It might not have “geometry” in the same way as standard mesh. (I’m no pro at SPS or much of anything, really). Maybe some SPS experts will visit the thread. Maybe @jerome ? (thx J)
I HOPE others comment, because… efficiency questions/concerns are not my expertise. I’m just a youngster, programming/tech-wise - a 4-year-old driving a top-fuel dragster.
Perhaps, in the end, you will find that creating a custom function like toggleHighlightOfParentAndKids()… is the most efficient way for your project. Does “efficient” sometimes mean… “easy for YOU to use, even if not lightning fast”?
Kzaky’s Family-Highlighting Toolkit… v1.0 Sure, the function(s) is/are tedious/intense, but you only need to code it once, and then you use it like a maniac… easily. AND, the rest of us get to steal your code/toolkit… cuz it’s super handy/powerful.