Unity - HasExitTime usage

This paper analyzes the problems AnimatorController animation switching transition, a transition that is Translation and hasExitTime problems. All the way to the actual project classification, planning logic diagrams, visual analysis to solve these problems.


AnimatorController animation controller

  • Function : Animation of an existing logical connection piece, connected to the transition mode Translation directed segment , which method comprises switching enable hasExitTime and closed hasExitTime
  • - Search.com : By setting the parameters Parameters transition is switched, can be a single line multiple conditions in a single direction may be a plurality of single-line conditions. Translation can be seen that any two selected movieclip intervals and windows, and the window Setting parameters table Inspecter
  • hasExitTime : Is there time to quit. Simple to understand: Wait for the current turn represents animation finished before the next movie; representation can be interrupted immediately shut down the current animation and play the next animation

Project combat

  • Background : There is idle, idle_2, attack_1, attack_2, attack_3 movieclip trifecta attack effect achieved, according to the switching attack value. We focus only on a few switches attack, in which
    • attack_1-> attack_2: Close hasExitTime, switching condition attack = 2, Translation does not exceed
    • attack_2-> attack_3: Open hasExitTime, switching condition attack = 3, Translation does not exceed
    • attack_1, attack_2, attack_3 switch to idle_2: switching condition attack = 0, an arbitrary code control determines animation has completed the attack = 0

AnimatorController:

attack_1-> attack_2 (left), attack_2-> attack_3 (right) Translation:

1. Close has exit time

Close has Exit Time: No exit latency, immediately open the next animation

  • Case 1: When attack_1 normal operation, the front left mark to reach a career change conditions
    • Translation open immediately (rather than waiting to run to the left mark) and attack_2, three parallel operation
      • If Translation is still running, but attack_1 first run to completion, represents the current cartoon attack_1 runs out (Code: (stateInfo.IsName("attack_1") && stateInfo.normalizedTime > 1)) == true), the judgment would logically be affected, this is very easy to make mistakes
      • If attack_1 still running, Translation has finished the first run, then immediately stop attack_1 fragment. Logic normal
    • Since then the whole movie full operation by the attack_2
  • Case 2: When attack_1 normal operation, in the left tag (left or right rear flag tag) to achieve conversion condition
    • Translation and immediately turned attack_2, three parallel operation
      • If Translation is still running, attack_1 run it off until, on behalf of the current cartoon attack_2 run to completion, the results above
      • If attack_1 still running, Translation was first finished running, immediately stop attack_2 fragment. Logic normal
    • Since then the whole movie full operation by the attack_2

FIG correction logic :(: count = 0 indicates attack = 0)

Projects Figure: Front left scale reached (first), and reach the standard left to complete (after) after Translation

2. Open has exit time

When has exit time: There exit latency, wait for the completion of the current animation to a certain stage before switching to the next animation. process:

  • I.: attack_2 normal operation, if left to reach the mark before the transition conditions
    • Waiting cartoon attack_2 be left to the mark, open the Translation and attack_3 transition animation animation ,, three parallel operation
      • When Translation is still running, but attack_2 first run to completion, represents the current cartoon attack_2 runs out (Code: (stateInfo.IsName("attack_1") && stateInfo.normalizedTime > 1)) == true), the judgment would logically be affected, this is very easy to make mistakes
      • If attack_2 still running, Translation has finished the first run, then immediately stop attack_2 fragment. Logic normal
    • At this point the whole animation full operation by the attack_3;
  • Case 2: attack_2 normal operation, if the condition reached after the left mark
    • Whether it is during or right after marking marking fulfillment of the conditions, can no longer be triggered Translation converted because the transition time slice can have missed

FIG correction logic :(: count = 0 indicates attack = 0)

Projects Figure: Front left scale reached (first), reach (after) left after Standard


to sum up

Translation within about Question mark:

  • Mark about the scope of meaning :
    • Translation long transition time length, two animations
  • Mark position about meaning :
    • For the Current Animation: Left numerals and the next opening time point Translation of Animation; right mark indicates a point in time later than the current that can be animated to
    • For the next Animation: left turn is marked as the current animation point of time, the right mark for the current operating point animation full time
    • Popular explanation: When conversion is complete, how long, the proportion of two animation conversion
  • Range significance :
    • E.g. attack_1 time segments and attack_2 transition, the transition animation according attack_1 Unity by mixing together and attack_2 animation, so -called three animation in parallel, to perform mixed nature of animation Translation . Its external note: still in a transition period attack_1 , the code is: stateInfo.IsName("attack_1")==trueonly when considered in attack_2 end Translation

Translation errors after Animation questions:

Intuitively, the error is two animations and Translation chronological problem, look at the numbers is Translation and last point, range size, conditional upon the timing. Therefore, solutions to focus on these points, some suggestions are given here:

  • Translation right mark preferably <= Animation front end, i.e. Translation not exceed the length of the animation
  • The best conversion conditions before reaching the left marker , so that we can control over the conversion process
  • AnimatorController the setting is not the only way, the code control, internal animation insertion events , etc., can better assist us to achieve secure handover animation

reference

Guess you like

Origin www.cnblogs.com/SouthBegonia/p/11748429.html