Bounding box ignores scale?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Bounding box ignores scale?

Post 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.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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.
Image Image Image
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post 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
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

Thanks!
Post Reply