In Part I of this three-part series, we saw how the free motion of rigid bodies can be simulated. In Part II, we saw how to make bodies aware of each other through collision and proximity tests. Up to this point, however, we still have not seen how to make objects truly interact with each other. The final step to simulating realistic, solid objects, is to apply constraints, defining restrictions on the motion of rigid bodies.
In this article, we'll discuss equality constraints and inequality constraints. We'll describe them first in terms of a force-based approach, where corrective forces are computed, and then in terms of an impulse-based approach, where corrective velocities are computed instead. Finally, we'll go over some clever tricks to eliminate unnecessary work and speed up computation.