I just had a go at implementing Bullet for the first time into my engine today.
I set everything up just like in CcdPhysicsDemo. Initiation and creation of rigid bodies seems to all be fine.
To move my graphic objects, I give them a pointer to their btRigidBody and then try to get their updated position every frame from it. This code is below.
Code: Select all
btTransform trans;
m_RigidBody->getMotionState()->getWorldTransform(trans);
btVector3& phys_pos = trans.getOrigin();
position.x = phys_pos.getX();
position.y = phys_pos.getY();
position.z = phys_pos.getZ();
I figure I'm probably doing something stupid or missing something here. What is the correct way to keep graphics object in sync with rigid bodies? Or is something else the problem?