hkpShape getAabb() gives strange hkAabb

hkpShape getAabb() gives strange hkAabb

Hi!
I would like to retrive the size of a hkpRigidBody. I tried to get hkpRigidBodyCinfo with hkpRigidBody::getCinfo(), then get the aabb with hkpRigidBodyCinfo::m_shape->getAabb().
But the aabb always has nonsense data, mostly much bigger values than the size of the physics world.

Any help is appreciated.

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Best Reply

Quoting - hdevfp
Hi!
I would like to retrive the size of a hkpRigidBody. I tried to get hkpRigidBodyCinfo with hkpRigidBody::getCinfo(), then get the aabb with hkpRigidBodyCinfo::m_shape->getAabb().
But the aabb always has nonsense data, mostly much bigger values than the size of the physics world.

Any help is appreciated.

Hi,
The best way to get a body's AABB is like this:

hkpRigidBody* rb = ... // your rigid body
hkAabb aabbOut;
float extraRadius = 0.0f; // this gets added to the AABB in each direction
rb->getCollidable()->getShape()->getAabb( rb->getTransform(), extraRadius, aabbOut );

Let me know if that helps...

-Chris

Quoting - havokchris

Hi,
The best way to get a body's AABB is like this:

hkpRigidBody* rb = ... // your rigid body
hkAabb aabbOut;
float extraRadius = 0.0f; // this gets added to the AABB in each direction
rb->getCollidable()->getShape()->getAabb( rb->getTransform(), extraRadius, aabbOut );

Let me know if that helps...

-Chris

Thaks for the relpy, havokchris, you solved the problem!
I understand now, getAbb() uses the given transformation to transform the shape's aabb, and using identity results the original sizes. (that's what I wanted for my in-engine physics visualisation tool.)
Thanks again!

Login to leave a comment.