BoundingBox - it's corners and orientation

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
PSVWizard
Posts: 11
Joined: Fri Aug 02, 2013 11:57 am

BoundingBox - it's corners and orientation

Post by PSVWizard »

Hi there,

may be it's my lack of knowledge but I'm running into a question while using BEPUPhysics.
It is illustrated if you look at the slope in the screenshot:
Image

The bounding boxes in the screen are made visible with a debug drawer similar to the one of the Utilities. The corners of each Bounding box are retrieved with the folliwing code

Code: Select all

Vector3[] bbC = entity.CollisionInformation.BoundingBox.GetCorners();
But regardles of the orientation of the object the collision shape of type Box was created from and in whatever direction it is rotated the bounding box seem to be never rotated. But the physics work very well. Behind the scenes the BoxShape is rotated well for collision checking and response. How could I get the "rotated" corners of the BoxShape to do the debug draw correctly ?

Any hint would be much appreciated..

BR PSVWizard
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: BoundingBox - it's corners and orientation

Post by Norbo »

The bounding box itself is an axis aligned bounding box used for broad phase collision detection. Its only job is to fully contain the shape, whatever the shape may be.

The corners associated with the rotated box are not stored anywhere internally. They can be computed pretty easily, though. Use the boxEntity.OrientationMatrix.Up, Right, and Forward vectors along with the height, width, and length of the box shape. For example, one of the corners would be {right * halfWidth, up * halfHeight, forward * halfLength}.
PSVWizard
Posts: 11
Joined: Fri Aug 02, 2013 11:57 am

Re: BoundingBox - it's corners and orientation

Post by PSVWizard »

Hi norbo,

Thanks for the explanation and the hint how to get the 'real' corners.

BR PSVWizard
Post Reply