Game Development Reference
In-Depth Information
btRigidBody .Astheseobjectsaremanipulatedinternally by the physics system,
thesecondmapprovidesaneasywaytomapeventslikecollisionsbackontothe
actors.
Components of the Bullet SDK
The most important component managed by Bullet is the btDynamicsWorld object.
This is the parent object that manages the other components and provides the main
interface point to Bullet
s internal physics system. When btDynamicsWorld's con-
structor is called, we pass in pointers to the other components in order to specify our
desired behavior.
One of those components is a subclass of btBroadphaseInterface . This class
manages the
'
of collision detection, which is the first test. This phase
is fast but inaccurate, using simple axis-aligned bounding boxes as placeholders for
actual collision geometry. This implementation uses Bullet
broad phase
s btDbvtBroadphase ,
which has good default behavior. Once a possible collision has passed this test, it is
sent to the
'
managed by btCollisionDispatcher .
The btCollisionDispatcher handles very precise collision detection between
objects in the system. Detecting collisions this way can be very slow, however, so
it only tests collisions that have passedthebroadphase.Onceco isionsare
detected, this object also dispatches the collision pairs to the world to be handled,
hence the name.
Next, let
narrow phase,
'
s look at the subclass of btConstraintSolver . In Bullet, a
constraint
is
a spring, hinge, or motor
s freedom of
motion. You can have hinge constraints on a door, slider constraints like a piston,
or basically anything you can think of. The btSequentialImpulseConstraint-
Solver manages these. Unfortunately, the scope of our physics system is too narrow
to really demonstrate constraints, but trust me, they
basically anything that restricts an object
'
'
re cool.
The final initialization component is btDefaultCollisionConfiguration . This
object manages some aspects of memory usage for the physics system. We
'
re using
the default configuration because we don
t want to do anything fancy with memory
allocation. A good exercise for you would be to implement your own pooled memory
manager and have Bullet use it. If you have a free weekend, of course.
The last object created here is BulletDebugDrawer , which actually handles debug-
ging tasks for your game engine. After all, a physics system can
'
'
t draw a line with a
renderer it knows nothing about, so you get to help it along. The same goes with
error reporting. Your game should be able to define how it wants to handle physics
system errors or informational messages.
 
 
Search WWH ::




Custom Search