synchronizeMotionStates() Problem.

DevO
Posts: 95
Joined: Fri Mar 31, 2006 7:13 pm

synchronizeMotionStates() Problem.

Post by DevO »

Hello,

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());
    }
Thanks DevO
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: synchronizeMotionStates() Problem.

Post by Erwin Coumans »

Hi Dev0,

I've not noticed such jumping yet. Is there any way to reproduce this 'jumping' on deactivation by modifying one of the Bullet demos?

Thanks!
Erwin
DevO
Posts: 95
Joined: Fri Mar 31, 2006 7:13 pm

Re: synchronizeMotionStates() Problem.

Post by DevO »

I will try to made demo a bit later.

After some additional test I realized that the shape thar will be draw in

Code: Select all

debugDrawObject(colObj->getWorldTransform(),colObj->getCollisionShape(),color);
has no jumping.
But the real geometry that is connected vie MotionState has small offset in the position after it goes sleep.
The offset is really small about 0.01 in mu tests but still visible with enough zoom.