Game Development Reference
We will steer a slightly different course. Our resolution system will look at each
collision in turn, and correct it. It will process collisions in order of severity (fast
collisions are handled first). It may be that resolving one collision in this way will
cause others to be made worse. We will have to structure the code so that it can take
account of this problem.
In chapter 18 I will look at the simultaneous resolution approaches. There is a
good chance that your physics needs will not require their sophistication, however.
While they are more stable and accurate than the methods in this part of the topic,
they are very much more complex and can be considerably slower.
T HE C OLLISION R ESOLUTION P IPELINE
Figure 14.10 shows a schematic of the collision resolution process. Collisions are gen-
erated by the collision detector based on the collision geometry of the objects in-
volved. These collisions are passed into a collision resolution routine, along with the
rigid-body data for the objects involved.
The collision resolution routine has two components: a velocity resolution system
and a penetration resolution system. These correspond to the two algorithms that
have made up the majority of this chapter.
These two steps are independent of each other. Changing the velocity of the ob-
jects doesn't affect how deeply they are interpenetrating, and vice versa. 5
F IGURE 14.10
Data flow through the physics engine.
5. Actually this is not strictly true: changing the position of objects can change the relative position of
their contacts, which can affect the velocity calculations we've used in our algorithm. The effect is usually
tiny, however, and for practical purposes we can ignore the interdependence.