Hi Erwin!
I just started on a new project where it makes sense to separate simulation and rendering into two separate threads. The game world's existing asynchronous streaming of data (including collision geometry) makes it necessary to add some mutex locking to prevent adding/removing objects to bullet while it is doing a simulation step, amongst other things.
So for example, my implementation of removeCollisionObject just looks like this:
Code: Select all
void MyDynamicsWorld::removeCollisionObject(btCollisionObject* collisionObject)
{
m_mutex.lock();
btDiscreteDynamicsWorld::removeCollisionObject(collisionObject);
m_mutex.unlock();
}
Similar additions to stepSimulation and addCollisionObject, addRigidBody, etc.
I can keep you posted on how it all goes, I need to take care of the interpolation/extrapolation next (the motionstate system).
Best regards,
Ola