Pulsating bounding boxes

kermado
Posts: 20
Joined: Tue Jan 12, 2016 11:20 am

Pulsating bounding boxes

Post by kermado »

Does anyone know why the size of the AABBs pulsate when the associated rigid body is rotating? For example, the size of the AABB for a capsule will oscillate when the capsule is just rolling on its side.

See also the following video of a kinematic body with just a cylinder collision shape: https://goo.gl/x1hsJH
And here is another with a compound collision shape: https://goo.gl/yw2PT4
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Pulsating bounding boxes

Post by drleviathan »

It looks like the Aabb is actually the tight bounding box around a spinning local Obb. The implementation of btCylinderShape::getAabb() is as follows:

Code: Select all

void btCylinderShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
{   
    btTransformAabb(getHalfExtentsWithoutMargin(),getMargin(),t,aabbMin,aabbMax);
}
Yup. This is a very simple/fast way to implement it. Although the final box is sometimes larger than it needs to be, it is never too small, and it works for all rotations, not just rotations about the cylinder's axis of symmetry.