Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

how can one-time transition and re-transition to state in mecanim ?

Discussion in 'Animation' started by ekflame, Nov 12, 2013.

  1. ekflame

    ekflame

    Joined:
    Apr 10, 2013
    Posts:
    5
    hello~

    I need to play hit-animation any time when hit. therefore I added a bool-hit variable and set it to transition condition to 'hit-state'.
    and 'hit-state' back to idle-state at end of animation, but it re-transition to 'hit-state' because of 'bool-hit' is still true.

    of course i know this example
    ...
    animator.SetBool( 'bool-hit', true);
    ...
    if( animator is in 'hit-state' ? )
    animator.SetBool( 'bool-hit', false);
    ...
    but above example is very annoyed. and it is not useful reenter hit-state during hit-state cause of double hit before end of hit animation.
    In UnrealEngine4, I can handle it by AnimMontage ( it allow user to play any animation in animation graph node tree )

    is there any useful solution for it?
     
  2. ekflame

    ekflame

    Joined:
    Apr 10, 2013
    Posts:
    5
    mecanim 4.3 release note

    - Added Animator.GotoState scripting function. This function allow you at runtime to transition to any state in your controller.
    - Trigger parameter, a trigger is a boolean parameter that is reset by the controller when consumed by a transition.

    I will test it. I love you Unity4.3 ( not 4.2, just 4.3 )
     
    theANMATOR2b likes this.