Mecanim Animation System
Unity has a rich and sophisticated animation system called Mecanim. Mecanim provides:
- Easy workflow and setup of animations on humanoid characters.
- Animation retargeting - the ability to apply animations from one character model onto another.
- Simplified workflow for aligning animation clips.
- Convenient preview of animation clips, transitions and interactions between them. This allows animators to work more independently of programmers, prototype and preview their animations before gameplay code is hooked in.
- Management of complex interactions between animations with a visual programming tool. Animating different body parts with different logic.
Generic Animations
Supported Features
Animator Layer |
---|
Width |
Mask |
Blending |
Sync |
Timing |
Animator State |
---|
Motion |
Speed |
Multiplier |
Mirror |
CycleOffset |
WriteDefault |
Animator State Transition |
---|
Has exit time |
No exit time |
Fixed duration |
Transition duration |
Humanoid Avatars (Experimental)
The Mecanim Animation System is particularly well suited for working with animations for humanoid skeletons. Since humanoid skeletons are used extensively in games.
Because of the similarity in bone structure, it is possible to map animations from one humanoid skeleton to another, allowing retargeting and inverse kinematics. With rare exceptions, humanoid models can be expected to have the same basic structure, representing the major articulate parts of the body, head and limbs. The Mecanim system makes good use of this idea to simplify the rigging and control of animations. A fundamental step in creating a animation is to set up a mapping between the simplified humanoid bone structure understood by Mecanim and the actual bones present in the skeleton; in Mecanim terminology, this mapping is called an Avatar.
Unity version support
Version |
---|
2020.1 - 2020.3 |
2021.1 - 2021.3 |
2022.1 - 2022.3 |
2023.1 |
Supported Features
Mecanim support provides basic playback of humanoid animations. Available animator options:
Animator Layer |
---|
Width |
Blending |
AvatarMask |
Animator State |
---|
Motion |
Speed |
Multiplier |
Mirror |
CycleOffset |
WriteDefault |
Animator State Transition |
---|
Has exit time |
No exit time |
Fixed duration |
Transition duration |
RootMotion
Now we support basic RootMotion features:
Feature | Description |
---|---|
Builtin RootMotion | Builtin RootMotion is RM which calculation based on data provided from animation clip or/with respect to physics systems. Could be manually applied in user defined callbacks ( OnAnimatorMove, OnStateMove ) by calling Animator.ApplyBuiltinRootMotion() . |
MonoBehaviour.OnAnimatorMove | Callback for processing animation movements for modifying root motion. This callback will be invoked at each frame after the state machines and the animations have been evaluated. OnAnimatorMove Example
|
StateMachineBehaviour.OnStateMove | Called right after MonoBehaviour.OnAnimatorMove. |
Limitations
For now Humanoid animations feature are limited with Forward Kinematics step. Currently not supported features you can see is such table:
Features | Supported | Details |
---|---|---|
Blend Tree | No | Blend Tree overview |
Sub-StateMachine | No | Sub/Nested StateMachine overview |
Inverse Kinematics (IK) | No | Inverse Kinematics (IK) overview |
Performance
Mecanim may negatively impact performance on some devices, or they may not work at all. This could be related to the device specific limitations. In order to resolve this issue, try decrease amount of active humanoid characters.