Page 1 of 1

Bounding box ignores scale?

Posted: Thu Jul 19, 2007 3:06 pm
by kendric
Is getBoundingBox supposed to ignore scale?
I looked at the code and it appears to just use the mesh's bounding box. In debug, I get numbers from that function that are not scaled.
Is this intended. I can multiply the scale myself but just making sure I am not missing something.

Posted: Thu Jul 19, 2007 3:31 pm
by JP
I think you have to recalculate the bounding box after applying the scale (and probably any other adjusments to the mesh), should be a function to do that.

Posted: Thu Jul 19, 2007 3:57 pm
by vitek
Yes, the bounding box is supposed to ignore scale. It is supposed to ignore the scale, rotation and translation that are applied to the scene node. The bounding box is an axis aligned box that is in the models local coordinate system. That means that if the mesh is 1 unit tall, the bounding box will be exactly 1 unit tall, even if the scene node will scale the model up 100 units tall.

If you are going to do calculations using the bounding box, you need to make sure to transform everything into the same coordinate system. So if you want to see if two objects intersect, you transform one or both boxes into the same coordinate system and then do an intersection test. Usually you'd transform the boxes to the world coordinate system using node->getAbsoluteTransformation().transformBoxEx().

Travis

Posted: Thu Jul 19, 2007 4:27 pm
by kendric
Thanks!