request: btCollisionWorld add/remove CollisionObject virtual

ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

request: btCollisionWorld add/remove CollisionObject virtual

Post by ola »

Here is a tiny feature request:

Please make the methods addCollisionObject and removeCollisionObject in btCollisionWorld.h virtual. :-)

Best regards,
Ola
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: request: btCollisionWorld add/remove CollisionObject virtual

Post by Erwin Coumans »

Sure, we'll do so for the upcoming release.

Just curious how you want to use it? Perhaps your other modifications can be rolled back into Bullet too?
Thanks,
Erwin
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Re: request: btCollisionWorld add/remove CollisionObject virtual

Post by ola »

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