Bullet Questions

sandeep_slash
Posts: 48
Joined: Thu Jul 10, 2008 6:36 pm

Bullet Questions

Post by sandeep_slash »

1. Can I explicitly specify that I need to check collision between a particular pair of collision objects? (just like in ODE
dCollide(geom1, geom2)....

2. My application wants to use simulation and collision routines separately at different places. What would be the best way to do this? I see that CollisionDetection routine is used separetly in CollisionInterfaceDemo. Thatz fine, but I also want to use stepSimulation as well @ a different place.

3. Sry, I'm repeating this question (which is another thread). Can I explicitly check collision between a particular geom (of a composite object) with another object in the world? I don't want to check collision between the entire Composite Object with another object....

Thanks,
Sandeep.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Bullet Questions

Post by Erwin Coumans »

Both (1) and (3) can be done by creating a btBroadphasePair with the two collision objects, calling the dispatcher for a collisionAlgorithm and calling the 'processCollision' on the collisionAlgorithm. Then you can delete the collisionAlgorithm. Note that it is more efficient to rely on caching, rather then manually creating a collision algorithm every frame.

See also btCollisionDispatcher::defaultNearCallback, in bullet\src\BulletCollision\CollisionDispatch\btCollisionDispatcher.cpp

You can collide with just one single shape (Bullet doesn't have geoms) of a compound shape, by creating a new btCollisionObject or temporarily replacing the compound shape in an existing collision shape by the child shape. See also btCompoundCollisionAlgorithm::processCollision for more implementation details.

For (2), it really depends on what you want to do. You are free to create a second collision world, or manually call the collision calls.

Check out the Kinematic Character Controller, in particular KinematicCharacterController::recoverFromPenetration, to see how to manually call the collision detector for an array of persistent collision pairs.

We plan to add a single discrete pairwise collision query to the btCollisionWorld. This might help (1),(2) and (3), but this will be slower then the persistent pairs approach used in the KinematicCharacterController.

Hope this helps,
Erwin
sandeep_slash
Posts: 48
Joined: Thu Jul 10, 2008 6:36 pm

Re: Bullet Questions

Post by sandeep_slash »

Thatz awesome... thnx...