Game Development Reference
In the first part of the sequence the boxes are in resting contact; in the second part
they have interpenetrated slightly as the result of gravity. In the third part they have
had their interpenetration resolved, with both linear and angular components to the
resolution. In the fourth part of the sequence the contact resolution is complete. The
first three parts of the second line of the sequence show another iteration of the same
process: interpenetration, penetration resolution, and contact resolution.
Over time it is clear that the boxes are moving apart. They are sliding apart, even
though they have infinite friction. By the time we reach the final part of the sequence,
the top box in the figure has moved so far it can no longer be supported by the lower
box and has begun to fall.
This is caused by the sequential contact resolution scheme. While the resolution
algorithm is considering contact A, it cannot also be considering contact B. But when
we have friction, the coefficient of friction at B has an effect on how contact A should
be resolved. No amount of minor adjustment will solve this problem: to get around
it we would need to process contacts simultaneously or create a good deal of special-
case code to perform contact-sensitive penetration resolution.
In practice this isn't a major problem unless you are building stacks of blocks.
Even in this case the sleeping system we will build in the next chapter ensures that
the sliding will occur only after the player disturbs the stack. If you need to build
large stacks of objects that are stable to slight knocks, you can either use one of the
simultaneous resolution approaches in chapter 18 or use fracture physics, which is
described in chapter 17.
Resting contacts can be dealt with as if they were tiny little bouncing contacts: the
contact interpenetration is resolved, and the closing velocity is killed by applying a
By reducing the resting forces over the whole duration of one simulation frame
into just an instant of impulse, we were able to simply add friction to the engine. The
effects of friction modify the impulse before it is applied to the objects in contact. This
is a simple and powerful approach to friction, but it isn't without its problems. It is
much more difficult to show the difference between static and dynamic friction using
micro-collisions (in fact we've avoided the problem by combining the coefficients into
Another problem with contacts simulated using micro-collisions is that they can
appear to vibrate slightly. This is one of a set of stability problems that our current
engine implementation faces. In chapter 16 we'll look at stability as a whole, and
improve our engine's realism. Then we'll look at how to improve its performance by
optimizing the code to do less unnecessary work.