661
by the physics system. (See Chapter 11 for more details on skeletal anima-
tion.)
Of course, implementing a rag doll is not quite as simple as I’ve made it
sound here. For one thing, there’s usually not a one-to-one mapping between
the rigid bodies in the rag doll and the joints in the animated skeleton —the
skeleton usually has more joints than the rag doll has bodies. Therefore, we
need a system that can map rigid bodies to joints (i.e., one that “knows” to
which joint each rigid body in the rag doll corresponds). There may be addi-
tional joints between those that are being driven by the rag doll bodies, so the
mapping system must also be capable of determining the correct pose trans-
forms for these intervening joints. This is not an exact science. We must apply
artistic judgment and/or some knowledge of human biomechanics in order to
achieve a natural-looking rag doll.
12.4.8.8. Powered Constraints
Constraints can also be “powered,” meaning that an external engine system
such as the animation system can indirectly control the translations and orien-
tations of the rigid bodies in the rag doll.
Let’s take an elbow joint as an example. An elbow acts prett y much like
a limited hinge, with a litt le less than 180 degrees of free rotation. (Actual-
ly, an elbow can also rotate axially, but we’ll ignore that for the purposes of
this discussion.) To power this constraint, we model the elbow as a rotational
spring. Such a spring exerts a torque proportional to the spring’s angle of de-
fl ection away from some predefi ned rest angle, N = –k(θ – θ rest). Now imagine
changing the rest angle externally, say by ensuring that it always matches the
angle of the elbow joint in an animated skeleton. As the rest angle changes, the
spring will fi nd itself out of equilibrium , and it will exert a torque that tends
Bone Collision Capsule
Capsule strikes
an obstacle
Bone continues
to move
Figure 12.34. Left: with a powered rag doll constraint, and in the absence of any additional
forces or torques, a rigid body representing the lower arm can be made to exactly track the
movements of an animated elbow joint. Right: if an obstacle blocks the motion of the body, it
will diverge from that of the animated elbow joint in a realistic way.
12.4. Rigid Body Dynamics