Game Development Reference
unsigned added =
When run, this is a fast and effective ragdoll model. It isn't the most stable method,
however. For very large ragdolls a lot of interpenetration resolution iterations are
needed to keep the extremities from wandering too far from their correct place.
More Complex Joints
The approach of the ragdoll demo is about as simple as possible to get useful joints.
Joints are a common feature of physics engines, and they can be considerably more
complex. In particular joints are used to remove the freedom of one object to move
relative to another.
The joints we have used (called “ball-joints”) take away the freedom of one object
to move linearly with respect to another. There are also joints that restrict movement
even more: hinges that restrict the ability of one object to rotate with respect to an-
other and piston joints that allow relative movement in one direction only.
Implementing these more flexible joints in the engine we have built is, quite
frankly, inconvenient. What I have done here, trying to represent joints in terms of
contacts, works for ball-joints but becomes very difficult for other kinds of joints.
In creating joints for this kind of engine I have followed approximately the same
algorithm as that used for contacts (which are effectively joints that limit the motion
of two objects from overlapping), but used different sets of tests to determine the
adjustments needed. A hinge joint, for example, needs to check how twisted the two
objects are and implement interpenetration-like resolution to bring them back into
Force-based engines with simultaneous resolution of contacts normally use a
mathematical structure that makes it very easy to create a huge range of joints with
minimal additional implementation effort. In the next chapter we'll look at the al-
gorithms that support this. If you are going to make a lot of use of joints and need
something more comprehensive than the simple contact-based joints in this section,
it may be worth biting the bullet and upgrading your contact resolution scheme. For
the sake of efficiency, ease of implementation, and programmer sanity, however, it is
worth giving the simple approach a try.
F RACTURE P HYSICS
If ragdoll physics is the current hot physics application, then fracture physics isn't far
behind. Particularly in shooters, players want to see objects destroyed in a realistic
way: wood should splinter, glass should shatter, and falling crates should crack to
reveal their contents.