I have noticed jumping of the body after it goes sleep.
The problem seems to be in body->getInterpolationWorldTransform() with will be probable still changed after body goes sleep or something similar.
But after this changes in btDiscreteDynamicsWorld::synchronizeMotionStates() the problem seems to be solved!
Is this right way to do it?
Code: Select all
//we need to call the update at least once, even for sleeping objects
//otherwise the 'graphics' transform never updates properly
//so todo: add 'dirty' flag
if (body->getActivationState() != ISLAND_SLEEPING)
{
btTransform interpolatedTransform;
btTransformUtil::integrateTransform(
body->getInterpolationWorldTransform(),
body->getInterpolationLinearVelocity(),
body->getInterpolationAngularVelocity(),m_localTime,interpolatedTransform);
body->getMotionState()->setWorldTransform(interpolatedTransform);
}else{
body->getMotionState()->setWorldTransform(body->getWorldTransform());
}