Introduction to the Unity Mecanim animation system

Table of contents

foreword

text

1. Animator component

2. Create AnimatorController

3. Create a new state

4. State switching

Has Exit Time: 


foreword

Mecanim is the first rich and complex animation system provided by Unity, providing: Simple workflow and animation creation capability for humanoid characters Retargeting (motion redirection) function, that is, applying animation from one character model to another character model ability on. Simple workflow for Animations Clips, preview capability for animation clips and their transitions and interactions. A visualization window for managing complex interactions between animations. The movement capabilities of different body parts are controlled by different logics.

The following is a brief introduction.

text

1. Animator component

  • Controller: The Animator Controller file used.
  • Avatar: The skeleton file used.
  • Apply Root Motion: Whether the position of the GameObject bound to this component can be changed by animation (if there is an animation that changes the displacement).
  • Update Mode: Update mode: Normal means use Update to update, Animate Physics means use FixUpdate to update (usually used when interacting with objects), Unscale Time means update regardless of timeScale (usually used in UI animation).
  • Culling Mode: Culling mode: Always Animate means that the animation will be updated even if the camera is invisible, Cull Update Transform means that the animation will stop when the camera is invisible but the position will continue to update, Cull Completely means that all updates of the animation will be stopped when the camera is invisible .

2. Create AnimatorController

There are three initial states by default:

  • Entry: Indicates the entry when entering the current state machine, the state connected to this state will become the first state after entering the state machine;
  • Any State: Represents any state, and its role is that the state it points to is a state that can be switched at any time;
  • Exit: means to exit the current state machine, if any state points to the exit, it means that the current state machine can be exited from the specified state;

3. Create a new state

Right click ➡ Create State ➡ Empty.

This state can be set as the default state, right click ➡ Set as Layer Default State.


4. State switching

Right-click ➡ Make Transition.

State transitions can be performed by changing parameters.

  • Float: parameter of float type, mostly used to control floating-point parameters inside the state machine;
  • Int: parameter of type int, mostly used to control the integer parameter inside the state machine;
  • Bool: bool type parameter, mostly used for state switching;
  • Trigger: It is also a bool type parameter in essence, but its value is false by default, and after setting it to true, the system will automatically restore it to false;

Has Exit Time: 

If we check this option, when the animation is converted, it will wait for the current animation to finish playing before switching to the next animation. If the current animation is a loop animation, it will wait for the conversion when the current playback is completed, so when the animation needs to be converted immediately Remember to uncheck it.

In another case, when my current animation finishes playing, it will automatically switch to the next state pointed to by the arrow (there are no other jump conditions). At this time, this option must be checked, otherwise the animation will be stuck after the animation finishes playing. The last frame, if it is a looping animation, will keep looping.

Supongo que te gusta

Origin blog.csdn.net/flyTie/article/details/127188394
Recomendado
Clasificación