I am slightly confused about the CORRECT way to deduce the position of children of btCompoundShapes.
I have a concave object, actually composed of several btBoxShape collision objects. These children are added like this:
Code: Select all
btTransform t;
t.setIdentity();
t.setOrigin( offset );
m_compoundShape->addChildShape( t, child->GetBody()->getCollisionShape() );
At render time I need to know the position of each child, relative to the btRigidBody:
Code: Select all
btTransform bodyTrans, childTrans;
btMotionState* ms;
ms = m_body()->getMotionState();
ms->getWorldTransform(bodyTrans);
childTrans = m_compoundShape->getChildTransform( 0 ); // other indexes too
bodyTrans *= childTrans;
// render using bodytrans
My problem is, the position of the rigidBody and that of the children resolved by the above code, do not match.
I think the bodyTrans *= childTrans line is the bad one, but dont know how to progress.
Thanks for any advice.
Simon