Menu
Lumberyard
Legacy Reference

Ragdoll Physics

You can add physics to your ragdoll skeleton using either the Ragdoll component entity or by using the legacy DeadBody entity.

Using the Ragdoll Component Entity

Using the Ragdoll component entity is an easy way to test out your ragdoll asset. This requires that you have created a .cdf file using the character's skeleton .chr file that was exported from your DCC with ragdoll simulation attributes on the joints and with physics mesh proxies.

To set up a Ragdoll component entity

  1. In Lumberyard Editor, right-click in your level and select Create new component entity.

  2. Click Tools, Entity Inspector to view your component entity's settings, if the window is not open already.

  3. In the Entity Inspector window, click Add Component.

  4. Choose Physics, Ragdoll.

    A Skinned Mesh component is automatically added to the Ragdoll component on your entity because it is required for the ragdoll component.

  5. Under the Skinned Mesh component, expand Rendering.

  6. For the Skinned asset parameter, click the (...) icon and locate your character's .cdf file for the ragdoll and assign it to the entity.

    You can also use the bidped.cdf file located for the SamplesProject at Objects/Tutorials/Biped/ to test if you do not have a ragdoll character.

  7. Under the Ragdoll, select the Enabled initially check box.

  8. Click AI/Physics at the bottom of Lumberyard Editor to view the ragdoll physics for your character. Click the button again to reset the character.

  9. Make additional adjustments to your Ragdoll component settings. For more information, see Rag Doll.

Note

To change the character joint rotations, you must change the simulation values on the skeleton in your DCC tool and then reexport the skeleton.

Using the (Legacy) DeadBody Entity

You may wish to use the legacy DeadBody entity for your ragdoll skeleton instead of using the Ragdoll component. The DeadBody entity is located on the Rollup Bar under Entity, Physics.

When you use the DeadBody entity, ragdoll skeletons may collapse in unpredictable ways. To counter this, use the following settings in the PhysParams and Properties panels in Rollup Bar:

  • ExtraStiff = 1 (enabled)

  • Mass = 80

  • Stiffness = 100

When you use the DeadBody entity, the ragdoll skeleton has the following characteristics:

  • The ragdoll skeleton bones act as switches, activating physicalization of the corresponding bone in the main skeleton.

  • The IK limits and dampening that are used in the physics mesh are read and used in ragdoll physics to limit and dampen the movement of any given joint.

  • Each node in the ragdoll skeleton stores physical properties for its corresponding bone in the deforming hierarchy, as stored in the physics bone IK properties.

  • The ExtraStiff parameter turns off constraints and attempts to maintain shape by pulling the bones toward an animation pose.

Fall-and-Play Movement

Fall-and-play movement is activated when a character is a ragdoll (that is, has the RelinquishCharacterPhysics value) with a greater than zero stiffness. This activates angular springs in the physical ragdoll that attempt to bring the joints to the angles specified in the current animation frame. When a character is still a ragdoll you can also turn the stiffness off with a GoLimp method.

The character tries to select an animation internally based on the current fall-and-play state. If there are no or very few physical contacts, the animation shows falling. Otherwise, the animation is the first frame of a standup animation that corresponds to the current body orientation.

Whenever there is an animation with a name that starts with Standup_, it's registered as a standup animation. Standup is initiated from outside the animation system through the appropriately named function. During the standup, the character physics is switched back into an alive mode with the final physical pose blended into a corresponding standup animation. This animation is selected from a standup animation list that best matches this pose.

You can control which type to use by _CSkeletonPose::SetFnPAnimGroup()_methods. At run time, Lumberyard checks the most similar standup animation registered to the current lying pose and starts blending.