Game Development Reference
In-Depth Information
1
2
3
Figure 2.9. Hard joint limits might start oscillating due to discretization.
2.7.3
Joint Limits
Some joints support limits that block either linear or angular motion. This is very
similar to a contact constraint. A common artifact with jointed structures with
limits is that they tend to shake and never come to rest. Even if a joint limit is
supposed to be a hard limit, it is usually a good idea to soften it up a tiny bit.
A hard limit that fully engages when limit is exceeded and fully disengaged oth-
erwise is very hard to get stable. Consider the limited hinge joint in Figure 2.9.
Before it hits the limit, the joint can move freely. Now, since the simulation is
carried out in discrete steps, this means that the joint limit will not kick in until
the limit is already exceeded. Once it is exceeded, the geometric term that is sup-
posed to correct the joint will kick the joint back, causing the limit to disengage
and fall back down again. This is a good example of how rapidly changing the
configuration causes instability.
Using soft limits, so that the hinge is allowed to rest on a spring for a certain
distance, will give the solver a chance to find equilibrium without changing the
configuration every frame.
2.7.4 Dealing with the Dead Guy
Ragdolls might qualify as the number one physics frustration worldwide, and
numerous games are still shipped with ragdolls doing the monkey dance while
“dead.” In my experience, ragdoll instability is due to two main factors—hard
joint limits and excess inter-bone collisions. Applying soft limits as described
above will get you halfway there. A ragdoll is a pretty complex structure, espe-
cially since it can end up on the ground in any pose, including one that engages
multiple joint limits.
Shaking usually appears either when the configuration changes or when there
are conflicting constraints. The more constraints there are to solve, the higher
chance there is for conflicting ones. Therefore, it is usually a good idea to disable
as many collisions as possible. Start with a ragdoll with all bone-bone collisions