filmov
tv
Unity Engine Animator and Animation Transition | How to use conditions with Animation Transition

Показать описание
Creating Animation Transition
- To create a transition between animations, go to Animator and create an int (data type) parameter called "Speed".
🤔 What is Animator? An Animator Controller allows you to arrange and maintain a set of Animation Clips and associated Animation Transitions for a character or object.
- After creating the Speed parameter set the conditions (transition condition), and click on the inspector tab to view these functions. The condition that we have to implement: if Speed is greater than 0 then set the transition from PlayerIdle to PlayerAnimation, else the Speed is 0 then the transition should set from PlayerAnimation to PlayerIdle.
*note* it is better to disable/uncheck the transition duration to avoid the transition lag (these fields are inside the settings inside the inspector tab).
🥸 How can we access the "Speed" (case sensitive) parameter in script?
It is straightforward to access the parameter because we have already initialized the Animator (in the last tutorial section) called anim, and we are getting the animator component in the void Awake () function (see the last lecture for reference).
Комментарии