“This is the fifth day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021.”

Mecanim Animation System Introduction:

Unity 4.0 was released on November 15, 2012. One of the biggest changes in Unity 4.0 is the introduction of a new animation system called MecAnim. With MecAnim’s new animation system, developers can easily control various animations of their characters.

Mecanim has the following characteristics:

  • Mecanim animation system uses Avatar as the agent to set the skeleton and skin in the character animation.

  • The developer can use the Retargeting feature of character animation to bind any other animation actions to any character model specified by the developer, so that the bound character will also have the specified animation function, which can be reused and greatly improve the development efficiency of the game. That is, Avatar can identify the bone structure of the character, the animation contained in it, and manipulate other models of the application through Retargeting.

  • When working with human character animations, developers can use animation state machines to handle transitions and logic between different animations.

  • It can be easily implemented through a graphical interface, rather than script to implement a bit of logic.

We can also use the body mask method to manipulate and change the animation behavior of different parts of the character’s body without having to modify the animation resources.

How Avatar works

For human characters, they all contain the same or similar skeleton. Avatar can analyze and identify the bone structure or role model contained in the role, compare it with the existing standard human skeleton in Mecanim, and mark it. It is an interface through which the Mecanim system can recognize a general skeletal structure that can be recognized by the Mecanim system and apply the action specified in one bone to another bone, namely Retargeting.

Create and configure Avatar

Select the character model and select the Rig TAB in the Inspector panel

The Animation Type property is divided into four types for selection.

Respectively is:

  • None (No animation type)

  • Legacy (Old animation type)

  • Generic (general, common type of animation)

  • Humanoid (human animation type).

Retargeting of Avatar

Only avatar-processed bones (which must be human bones) can be redirected through Retargeting, which means that avatar-processed bones have the same or similar bone structure, so that bones (or segments) can be reused or interused between different characters. That is, the skeleton or animation segment of character A can be applied to character model B (even character B can have no animation segment or own animation segment) to make it have the animation behavior of character model A, and vice versa.

Therefore, after Avatar processing, only one Animator Controller needs to be added to each model, and different models will have the same animation when playing the game

Avatar muscle setting

In addition to correctly matching the position of the bones, Muscles can be used to fine-tune the range of motion of the bones, so that the bones can be more properly coordinated and avoid body overlay or distortion in the bone animation.

In the Muscle Group Preview, you can see a series of different bone combinations working together. You can restore the default preview by clicking the Reset All button.

Per-muscle Settings allows you to adjust the range of individual skeletal muscles in different parts of the body and fine-tune the Settings.

If we want to restore the default values, we can do this by clicking the Muscles drop-down menu at the bottom and selecting Reset. You can also Revert by clicking the Revert button at the bottom before clicking on the Apply application.

The last group is set to Additional Settings. Can fine tune the distortion effect of the skeleton.

Finally, select the Apply application and select the Done button to save the tweaks and return to the game scene.