Game Development Reference
and look at collision detection.
In chapter 7 we added contacts and collisions to a particle engine, but we removed
them to introduce rotating rigid bodies. We're now on the road to having them back
in the engine. We could simply introduce contacts and collisions into the engine mag-
ically, without worrying about where they came from, just as in chapter 7. If you are
working with an existing collision detection library, then you can take this approach
and skip to chapter 14. This chapter and the next give an overview of where the con-
tact and collision information comes from and how it is generated.
I will not attempt to produce a comprehensive collision detection system. There
are books longer than this one on this one subject alone, and there are many pitfalls
and complications that would need discussing.
If you are working with an existing game engine, it is likely to have a collision
detection system that you can use. It is still worth reading through the following two
chapters, however. Not all rendering engines provide collision detection routines that
are inefficient (many use the same geometry as will be drawn, which is a waste of
processing time) or don't provide the kind of detailed contact data that the physics
I will step through one particular approach to collision detection that is useful for
smaller games. It is also useful as a jumping-off point into a more complete system
and as a way to raise the kinds of issue that are common to all collision detectors.
If you need to build a complete and comprehensive collision detection system,
then I'd recommend Ericson  in the same series as this topic. It contains many
In this chapter and the next we'll take a break from building the physics simulation