Game Development Reference
In-Depth Information
The following diagram shows how std::set_difference returns only objects
pairs that are present in the first set, but missing from the second set. Note that it
does not return new object pairs from the second set.
The most important function introduced in this chapter's source code is Check-
ForCollisionEvents() . The code may look a little intimidating at first, but it
simply implements the steps listed previously. The comments should help us to
identify each step.
When we detect a collision or separation, we will want some way to inform the game
logic of it. These two functions will do the job nicely:
virtual void CollisionEvent(btRigidBody*
pBody0, btRigidBody * pBody1);
virtual void SeparationEvent(btRigidBody *
pBody0, btRigidBody * pBody1);
In order to test this feature, we introduce the following code to turn colliding objects
white (and similar code to turn separating objects black):
Search WWH ::




Custom Search