文档

Unity Engine

Download Unity

Unity Engine

Create a ragdoll

Use the Ragdoll Wizard to create and configure a ragdoll.
阅读时间2 分钟最后更新于 9 天前

Use the Ragdoll Wizard to create and configure a ragdoll.
Unity can generate all the colliders, Rigidbody components, and joints that make up a ragdoll from a skinned mesh character.

Prerequisites

  • A skinned mesh character rigged with bones in a 3D modeling application.
  • A character imported with a Humanoid avatar, if you want to use Auto-Fill to assign the ragdoll bones automatically.

Create a ragdoll with the Ragdoll Wizard

Set up your character

To set up your character:
  1. Save a rigged skinned mesh character in your project's
    Assets
    folder.
  2. Select the skinned mesh file. If needed, in the Inspector window, select the Model tab and disable Generate Colliders, then select Apply.
  3. Drag the character from the Project window to the Hierarchy window to create an instance of it.

Generate the ragdoll

To generate the ragdoll:
  1. Select
    GameObject

    ?

    >
    3D Object

    ?

    > Ragdoll from the main menu. The Ragdoll Builder window opens.
  2. Assign the ragdoll bones in one of the following ways:
    • Automatically: In the Animator field, select your character's Animator component, then select Auto-Fill.
    • Manually: Expand Advanced Bone Setup, then drag each limb from the Hierarchy window to its related field.
  3. Select Create to generate the ragdoll.
Unity adds Rigidbody, Character Joint, and collider components to each assigned bone. To check how your ragdoll moves, enter Play mode.
For more information about the character joints that the Ragdoll Wizard creates, refer to Character Joint component reference.

Save the ragdoll as a prefab

To save the ragdoll as a prefab, drag the ragdoll character instance from the Hierarchy window into the
Assets
folder in the Project window.
Unity saves the ragdoll as a prefab asset that you can reuse in your project.

Additional resources