Local Bounding Box info of a group node?


#1

I am using Python (pymel)

For a regular geo I get the local bounding box by getting a bounding box info from its shape node.

Now, let’s say I have 3 different objects under a group node. How can I get object space bounding box info of this group node?

Group node has no shape node. How can I get object space bounding box for such nodes that have no shape node?

Any help would be very much appreciated. Thank you so much!


#2


#3

Hi
With the object under the group, select the group and see the bounding box information in the attribute editor.
Regards,


#4

Thank you shinyprem,

BTW I was trying to find how to do this in python but anyway if you try this, you will notice that those bb min max attribute vales are not reliable.

  1. Make a 4x4x4 Cubes and group it with a group node.
  2. Translate and rotate the group node
  3. in the node editor link
    -Group node’s Bounding box min to a locator
    -Group node’s Bounding box max to another locator

and those locators should always be at the min max bb positions of the group node but they don’t match at all.

And this is why I always get BB info from a shape node then multiply with world matrix. but since group node has no shape node I am totally lost how to get an object space bb info (equivalent to shape node’s BB info.)

If I am doing something wrong here, please let me know. Thank you so much.


#5

If you have the object local bounding box: Multiply each corner of each object’s bounding box by the world transform, then take the min x, min y and min z between them all, and that’s one corner. Do the same with max x, max y and max z and that’s the other corner.


#6

Thank you so much Jaco. I get everything else but would you please explain a bit more on how to do this “then take the min x, min y and min z between them all,”

EDIT > ah I see. so if I have min xyz values of

geoA 10, 10, 00
geoB 02, 05, 07
geoC 04, 03, 20

just take the minimum from each column right? ----> 02, 03, 00


#7

if you take all the x components of all corners of all bounding boxes, and then take its min, that’s your minX. Repeated for Y and Z, then repeat (on the same lists) to find the 3 max. This will yield two triplets of numbers, one (min) will be the vector of the min corner point, the other (max) will be the vector of the max corner point.
Does it make sense now?


#8

Absolutely! Thank you so much ThE_JacO!

This is great. thank you so much for taking the time to explain. :thumbsup: