(my main goal is to see where the center of mass is relative to the joint so I know how to control the joint motor in a balancing script)
However I seem to be unable to find the world position of the joint which I need in order to construct that matrix. With generic btTypedConstraints I was not able to get far so I started looking if I could solve this problem for the btHingeConstraint since there you have easy access to the connected bodies.
This is what I came up with:
Code: Select all
btTransform body_world_matrix;
joint->getRigidBodyA().getMotionState()->getWorldTransform(body_world_matrix);
btTransform world_to_joint = ( body_world_matrix * joint->getAFrame() ).inverse();