This Unity-3D tutorial is about retargeting. So what does this mean? Retargeting in connection with Mecanim and Unity-3D means that a 3D model / character is replaced with another one, but the animations that were applied to the character are re-applied to the new one.
So first of all let’s talk about the setup of the character – the Player in our example. The Player is an empty Gameobject which has a 3d model as child:
In the demo this model is a little rabbit we imported as fbx-file:
The model has a rig we added with blender (Armature->Human), and this rig is defined as a so called humanoid rig during the import of the fbx file:
Create an Animator Controller
The animations Idle, Run and Jump we re-use from the Mecanim demo. These animations are stored as fbx-files and you can use it in an Animatior Controller-component:
To add an Animatior Controller for your model choose
Create > Animator Controller from the Projects View. Then give the controller a name and drag it to the Animator component of your character.
How to retarget?
To replace the rabbit model we have to import the new one. In our case we use the cartoon dog we created in a previous tutorial:
After importing the dog character, also set the Animation Type to Humanoid in the Rig-Tab of the fbx-import panel.
Then you have to hide the rabbit model and drag the dog model in the project hierarchy as a child of the Player GameObject. Copy the Animator-component of the rabbit to the dog character but do not use the rabbitAvatar as Avatar, use the dogAvatar instead. You also have to make sure that the dog model is placed at position x=0, y=0 and z=0.
You can also see the project in action in our youtube video about retargeting animations for Unity3D and mecanim here:
If you have any questions please ask them here or as a comment on youtube. Also make sure to subscribe to our youtube channel so that you are informed about upcoming tutorials.by