In Bullet Physics, when I create a new btRigidBody, one of the parameters passed to the constructor is the btMotionState, which defines the initial pose of the body. However, if I then later want to change the pose of the body manually (for example, if it is a kinematic body), how can I do this?
What I have tried so far, is to use the body's setWorldTransform() function. For example:
glm::mat4 pose;
pose[3][0] = 0.5;
pose[3][1] = 2.0;
pose[3][2] = 1.0;
btTransform new_transform;
new_transform.setFromOpenGLMatrix((float*)&pose[0]);
my_body->setWorldTransform(new_transform);
However, when I then try to read the pose of the object again:
btTransform trans = my_body->getWorldTransform();
std::cout << "Y = " << trans.getOrigin().getY() << std::endl;
It returns the value set in the body's constructor, not the value set in setWorldTransform().
Please can somebody explain the different between the motion state, and the world transform, and how I should go about manually updating the pose of a kinematic object?