Get 'bounding box' scale,position of multiple nodes (without needing a parent)

Is there a techniique or function(s) in Babylon that can accommodate for returning the ‘bounding box’ position and scale of multiple; or just say 2 independent nodes?

You can do this pretty easily by making a blank ‘midnode’ and just assigning the two nodes to it however in my case I need to resepect the existing parent nodes of each respective object.

So basically, I’d like to be able to return what the scale/position would be if both objects were parented to a midnode but without … parenting them to a midnode. Thanks !

Welcome aboard!

I assume you mean bounding box of a mesh as nodes don’t have BB?

You will need to get the min/max vectors of each BB and compute the aggregated min/max: see “Drawing a bounding box around multiple objects” in Draw Bounding Boxes - Babylon.js Documentation

If you really are speaking of nodes, you can use getHierarchyBoundingVectors to get the min/max bounding vectors of a hierarchy node.

1 Like

Yes, thank-you for clarifying and suggesting that technique - looks like what is needed.

And thank-you for the welcome! I just tried Babylon for the first time this last weekend apart of Ludem Dare 47. I was delighted with how quickly and easy it was to get productive with it; great stuff.

1 Like