Collision detection callback.

jduran
Posts: 11
Joined: Sat Aug 13, 2011 2:55 pm

Collision detection callback.

Post by jduran »

Dear all,

I'm new to Bullet. I'm developing a simple game a ball in a maze. By now, I only need to detect the colision between two object: the ball and output of maze (the object that represents the output of the maze). I've trouble to understand how to collision notification callback is done.

In the CollisionInterfaceDemo, two mechanism could be used: iterate over manifolds of dispatcher or check explicitly if two rigid bodies collides.

Based on the code of CollisionInterfaceDemo, I was thinking that the bullet main loop could be like that:

btDynamicsWorld::stepSimulation(...);
btCollisionWorld::performDiscreteCollisionDetection();
btCollisionWorld::contactPairTest (btCollisionObject *colObjA, btCollisionObject *colObjB, ContactResultCallback &resultCallback);

Is this a valid?
Should contactPairTest be called at each iteration? does it registers the collision objects with callback?

Respect to CollisionInterfaceDemo, how is advanced the time? is it called stepSimulation?

My suggestion to improve the library is use pointers to release the memory automatically, for example std::auto_ptr<> (currently deprecated but included in old compilers) or the more recent unique_ptr<>.

Thanks and Best Regards,
Joaquim Duran
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: Collision detection callback.

Post by majestik666 »