Version: Unity 6.5 Alpha (6000.5)
Language : English
Humanoid Avatar
Inverse Kinematics

Retarget humanoid animation

Use retargeting to apply the same animation to different humanoid models without having to restructure skeletons or rename bones. Each humanoid model must use the Humanoid animation type and have a configured AvatarAn interface for retargeting animation from one rig to another. More info
See in Glossary
. A configured Avatar provides a standard hierarchy and bone names.

You might want to retarget humanoid animationAn animation using humanoid skeletons. Humanoid models generally have the same basic structure, representing the major articulate parts of the body, head and limbs. This makes it easy to map animations from one humanoid skeleton to another, allowing retargeting and inverse kinematics. More info
See in Glossary
in many situations. For example, you might want to reuse the same walk animation to animate different humanoid models. You might want to dynamically swap player characters at runtime.

This topic explains how to replace an animated model with a new model. When you replace the animated model it retargets the animation to the replacement model.

Prerequisites

To follow the steps in this topic, your project and sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
must have the following:

  • An animated humanoid model (old model). The old model is in the scene and it has a configured Avatar. The old model has an Animator component with an Animator ControllerControls animation through Animation Layers with Animation State Machines and Animation Blend Trees, controlled by Animation Parameters. The same Animator Controller can be referenced by multiple models with Animator components. More info
    See in Glossary
    and a state machineThe set of states in an Animator Controller that a character or animated GameObject can be in, along with a set of transitions between those states and a variable to remember the current state. The states available will depend on the type of gameplay, but typical states include things like idling, walking, running and jumping. More info
    See in Glossary
    . The old model might also have script components that handle user input and control state machine transitions.
  • A non-animated humanoid model (replacement model). The replacement model is in the Assets folder and not in the scene. The replacement model doesn’t have a configured Avatar. You will configure its Avatar and add the replacement model to the scene in the steps.

Retarget animation to a new humanoid model

To replace an animated humanoid model and retarget its animation to a new humanoid model, follow these steps:

  1. In the Project folder, select the replacement model. The Import Settings window opens in the InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
    See in Glossary
    window.

    The Import Settings window for the Archer model.
    The Import Settings window for the Archer model.
  2. Select the Rig tab.

  3. Set Animation Type to Humanoid.

  4. Select Apply. You must first apply before you can configure the replacement model’s avatar. This adds an Animator component to the model.

  5. Set the Avatar Definition to Create From This Model and select Configure. This creates a new avatar based on the hierarchy and bones of the model. This places Unity in Avatar Configuration mode. When you configure an Avatar, your model must be in a T-stance. For more information on how to configure an Avatar, consult Avatar Mapping tab.

  6. After you configure the Avatar, select Done.

  7. From the Project folder, drag the replacement model into your scene.

  8. Select the replacement model in the Hierarchy.

  9. In the Inspector window, use the Transform componentA Transform component determines the Position, Rotation, and Scale of each object in the scene. Every GameObject has a Transform. More info
    See in Glossary
    to adjust the replacement model’s starting location, rotation, and scale.

    The old Armature model and its replacement: the Archer model.
    The old Armature model and its replacement: the Archer model.
  10. In the Animator component, select the same Animator Controller used by the old model.

  11. In the Animator component, if the Avatar isn’t already selected, select the Avatar you configured for the destination model.

  12. If your old model has additional components and scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
    See in Glossary
    , add the same components and scripts to your replacement model. You might have to adjust property values to ensure that the retargeted animation works correctly with the replacement model.

  13. When the replacement model functions the same as the old model, you can delete the old model from your scene.

Additional resources

Humanoid Avatar
Inverse Kinematics