Game Development Reference
In-Depth Information
The
Connected Body
property refers to the rigidbody to which the Character Joint is attached. If its
value is None, then the joint connects to world space as seen with the Hinge Joint. The joint rotates
around the
Anchor
point in the game object's local space. As a ball-and-socket joint, it has an
Axis
to twist around and a separate
Swing Axis
to “swing” or bend around.
Use the
Low Twist Limit
and
High Twist Limit
properties to constrain the twisting movement of
the joint around the Axis, and the
Swing 1 Limit
and
Swing 2 Limit
properties to constrain the
movement around the Swing Axis.
Break Force
and
Break Torque
determine the amount of force required to break the joint, where
Infinity means the joint cannot be broken.
Ragdoll Physics
You may have noticed that when a pendulum strikes the player character, it might push the player
around a little bit, but that's all. A massive pendulum ought to have a bigger effect on the character,
like whacking him senseless so he collapses in heap like—you guessed it—a ragdoll.
Your player character has a rigidbody and simple Capsule Collider components so it can interact
with other game objects. For the physics engine to give your character's body and limbs realistic
physical properties, each discrete body part needs to have its own rigidbody and collider. In its
ever-helpful way, Unity provides a Ragdoll Wizard to assist you in creating these child rigidbodies
and colliders. Once your ragdoll is configured, you will save it as a prefab for reuse later.
First, in the Hierarchy select the Third Person Character and rename it Third Person Character
Ragdoll. Expand everything so you can see all the child body parts (Figure
7-10
). (You may find that
using the cursor keys rather than the mouse is easier to navigate and expand the tree hierarchy.)
Figure 7-10.
Third Person Character Ragdoll game object expanded in the Hierarchy view