Game Development Reference
undergraduate mathematics the problem is never mentioned. For complex scenarios
with lots of interacting objects and especially friction, it is significant, as we will see.
Notice that the reaction force between the ground and an object is a real force.
It isn't an impulse: there is no change in velocity. So far in our collision resolution
system we've only applied impulses. This reaction force cannot be represented in the
same way. We need to consider it more fully.
F ORCE C ALCULATIONS
The most obvious approach to resting contacts is to calculate the reaction forces.
That way we can add the forces into the equations of motion of our rigid bodies
(using D'Alembert's principle, as in section 10.3). With the reaction forces working
alongside the regular forces we apply, the body will behave correctly.
Many physics systems do exactly this. Given a set of contacts, they try to generate
a set of reaction forces that will keep the objects from accelerating together. For collid-
ing contacts they use one of two methods: they use either the same impulse method
we saw in chapter 14; or they use the fact that an impulse is simply a force applied
over a small moment of time—if we know the time (i.e., the duration of the physics
update), then the impulse can be turned into a one-off force and resolved in the same
way as other forces.
This approach is okay if you can accurately calculate the reaction forces every
time. For simple situations, such as an object resting on the ground, this is very easy.
But it rapidly gets more complex. Figure 15.2 shows a stack of objects. There are
many internal reaction forces in this stack. The reaction forces at the bottom of the
stack depend on the reaction forces at the top of the stack. The forces that need to be
applied at a contact may depend heavily on contacts at a completely different location
in the simulation, with no common objects between them.
To calculate reaction forces we cannot use an iterative algorithm like those in the
last chapter. We have to take a more global view, representing all the force interactions
in one mathematical structure and creating a one-for-all solution. In most cases this
can be done, and it is the mathematical core of most commercial physics middleware
packages. We'll look at the techniques used when we get to chapter 18.
In some cases, especially when there is friction at resting contacts, there is no so-
lution. The combination of reaction forces cannot be solved. This often occurs when
the simulation drifts (through numerical calculation errors or because of stepping
through time and missing the exact time of contact) into a state that could not occur
in reality. The computer is trying to solve a problem that is literally impossible.
The same problem can also occur because we are assuming perfectly rigid bodies,
where in reality all objects can be compressed to some degree. And finally it can occur
when what appears to be a resting contact would in reality be a collision. If you slide
an object along a rough surface, for example, you may be able to get it to suddenly
leap into the air. This occurs because a contact that appears to be a resting contact
with the ground may in reality be a collision against a patch of high friction.