Hi,
I'm using the active transform to update all object of my scene linked to physx actors.
The problem is character controller never rotate (only if the up vector change) so I would only update translation for them.
A way exists to know if the physx actor is linked to a character controller, maybe a flag can be set on the actor ?
Here the code I use to update object of my scene :
// Get active transforms.
physx::PxU32 ActiveTransformCount;
const physx::PxActiveTransform* ActiveTransformArray = m_Scene->getActiveTransforms( ActiveTransformCount );
// Update each actor with the new transform.
for( physx::PxU32 i = 0; i < ActiveTransformCount; ++i )
{
if( ActiveTransformArray[ i ].userData )
{
const physx::PxTransform& Transform = ActiveTransformArray[ i ].actor2World;
IActor* Actor = static_cast< IActor* >( ActiveTransformArray[ i ].userData );
Actor->SetTranslation( CVector3( Transform.p.x, Transform.p.y, Transform.p.z ) );
Actor->SetRotation( CQuaternion( Transform.q.x, Transform.q.y, Transform.q.z, Transform.q.w ) );
}
}
EDIT : Maybe the only solution is to set my object component as user-data of the physx actor and check the component type and update the owner of the component.