kinematic motion state not synchronizing correctly
Posted: Mon May 05, 2014 1:55 am
I have some kinematic bodies that I move through game logic/animations, and then I use the motion state on each update to synchronize the kinematic rigidbody, but the thing is it isnt syncrhonized correctly, its always behind the rendering representation, just like there was some kind of offset.
You can see it in the video (select hd since the debug boxes are difficult to see), the blue moving platforms and objects.
https://www.youtube.com/watch?v=daAFLZj ... e=youtu.be
Im using the same motionstate as here http://www.bulletphysics.org/mediawiki- ... tionStates since im using ogre too, and then on each update of the platforms/objects I do:
passing the node positions to the motion state to update.
I create the rigidbody like this:
any idea of why is this happening and how can I fix it?
You can see it in the video (select hd since the debug boxes are difficult to see), the blue moving platforms and objects.
https://www.youtube.com/watch?v=daAFLZj ... e=youtu.be
Im using the same motionstate as here http://www.bulletphysics.org/mediawiki- ... tionStates since im using ogre too, and then on each update of the platforms/objects I do:
Code: Select all
m_pMotionState->setKinematicPos(btTransform(
BtOgre::Convert::toBullet(m_pNode->_getDerivedOrientation()),
BtOgre::Convert::toBullet(m_pNode->_getDerivedPosition()) ) );I create the rigidbody like this:
Code: Select all
//my motion state
BtOgre::RigidBodyState* motionState = new BtOgre::RigidBodyState
(pNode, btTransform(BtOgre::Convert::toBullet(rotation),
BtOgre::Convert::toBullet(position)) );
btRigidBody *rigidbody;
btRigidBody::btRigidBodyConstructionInfo rigidbodyCI(
0,
motionState,
collShape,
btVector3(0,0,0)
);
rigidbody = new btRigidBody(rigidbodyCI);
rigidbody->setFriction(0);
rigidbody->setRestitution(0);
rigidbody->setActivationState(DISABLE_DEACTIVATION);
rigidbody->setCollisionFlags(rigidbody->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT);