In this recipe, we use the Character Joint components to create a ragdoll from scratch. Every such component works with a Rigidbody component and a Collider component that have to be attached to the same game object. We can create chains of Character Joint components by dragging a connected game object to the Connected Body field of the joint.
Character Joint components have a set of parameters we can tweak:
- Connected Body: This is the parent object to which the joint is connected.
- Anchor: This is the point in space the joint rotates around.
- Axis: This is the twist axis—the one our bone will twist around. It is visualized with an orange arrow.
- Auto Configure Connected Anchor: Enable this if you want Unity to try to autoconfigure the Connected Anchor.
- Connected Anchor: If you disable the Auto Configure Connected Anchor, you can manually configure it here.
- Swing Axis: This is the axis our bone will swing (or bend) around . It is visualized with a green arrow.
- Low Twist Limit: This is the lower limit angle for bone twisting.
- High Twist Limit: This is the higher limit angle for bone twisting.
- Swing 1 Limit: This is the lower limit angle for bone swinging.
- Swing 2 Limit: This is the upper limit angle for bone swinging.
- Break Force: This is the force needed to break the joint.
- Break Torque: This is the torque needed to break the joint.
- Enable Collision: If this is checked, collisions between rigid bodies connected to this joint are enabled.
- Enable Preprocessing: This is used to stabilize impossible-to-fulfill scenarios.