Final transformation for shape AABB

Final transformation for shape AABB

Hi,

I have a rigid body. I need to get the AABB in world space in the final position.
The scene was exported from 3DS Max, it contains the mesh and the physical data for single rigidbody.

I do:

const hkpCollidable* pCollid = phkPhysBody->getCollidable();
assert( pCollid != NULL );

const hkpShape* pShape = pCollid->getShape();
assert( pShape != NULL );

hkAabb hkBox1, hkBox2;

pShape->getAabb( pCollid->getTransform(), 0.0f, hkBox1 );
pShape->getAabb( phkPhysBody->getTransform(), 0.0f, hkBox2 );

But I get a boxes not in the final transformation of the body. Mesh located on the other axes in origin. Transformation is applied to shape when scene is loading.But the transformation of hkpRigidBody andhkpCollidable does not allow it.

How do I transform the AABB in the final position?

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

Hi,

You have a piece of code like the following, correct? :

hkAabb aabbOut;
hkReal tolerance = 0.0f;
hkTransform worldTransform = rigidBody.getTransform();
rigidBody.getShape()->getAabb( worldTransform, tolerance, aabbOut );

This should get you the world-space Aabb of the body (I don't think you need to access the collidable).

I'm not sure I understand what you mean by "Mesh located on the other axes in origin" and "Transformation is applied to shape when scene is loading" but it could be that this is a problem with the export from 3dsMax.

To check, what is your physics world's 'up' axis?
And is that the same as the 'up' axis when modelling in 3dsMax?

If not, you'll have to use the Transform Scene filter in the Havok Content Tools inside 3dsMax so that the coordinate systems align correctly.

Cormac

Hi Cormac,

I guess I was wrong. All okay with the transformation.

In 3DS Max and Havok Content Tools up axis is Z. This is Y in my engine.

But I put the gravity (0, -10, 0) in the engine for Havok Physics, I copy the transformation of bodies as it is and everything works. Up axis is Y!

I'm confused.

Leave a Comment

Please sign in to add a comment. Not a member? Join today