Bullet Physics
Loading...
Searching...
No Matches
Collision Detection

The collision detection provides algorithms and acceleration structures for closest point (distance and penetration) queries as well as ray and convex sweep tests. The main data structures are:

  • btCollisionObject is the object that has a world transform and a collision shape.
  • btCollisionShape describes the collision shape of a collision object, such as box, sphere, convex hull or triangle mesh. A single collision shape can be shared among multiple collision objects.
  • btGhostObject is a special btCollisionObject, useful for fast localized collision queries.
  • btCollisionWorld stores all btCollisionObjects and provides an interface to perform queries.

The broadphase collision detection provides acceleration structure to quickly reject pairs of objects based on axis aligned bounding box (AABB) overlap. Several different broadphase acceleration structures are available:

  • btDbvtBroadphase uses a fast dynamic bounding volume hierarchy based on AABB tree
  • btAxisSweep3 and bt32BitAxisSweep3 implement incremental 3d sweep and prune
  • btSimpleBroadphase is a brute force reference implementation. It is slow but easy to understand and useful for debugging and testing a more advanced broadphase.

The broadphase adds and removes overlapping pairs from a pair cache. Overlapping pairs are persistent over time and can cache information such as previous contact constraint forces that can be used for ‘warmstarting’: using the previous solution to converge faster towards constraint solving.

A collision dispatcher iterates over each pair, searches for a matching collision algorithm based on the types of objects involved and executes the collision algorithm computing contact points.

  • btPersistentManifold is a contact point cache to store contact points for a given pair of objects.