Hi!
I want to be able to draw a box around selected objects, but I’m unsure as to how to work out the total bounding extents of the selected transform and all of its children.
The child objects may be smaller, larger and have different center positions.
Thanks for any help - it’s been baking my noggin!
Jeff.
Something like this (untested):
var totalBounds = new Bounds(Vector3.zero, Vector3.zero);
var renderers = GetComponentInChildren(Renderer);
for (render in renderers)
totalBounds.Encapsulate(render.bounds);
–Eric
2 Likes
Ooooo Encapsulate is a new one on me! Awesome! Thanks again, Eric. You really are a star in this community, mate!
Jeff.