Search Unity

How to rewind animation (with Animator) from current time and position?

Discussion in 'Animation' started by loover, Oct 22, 2014.

  1. loover

    loover

    Joined:
    Oct 18, 2014
    Posts:
    6
    How to rewind animation (with Animator) from current time and position? For sprite sheet 2D animation.
     
  2. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    edpereirajr likes this.
  3. loover

    loover

    Joined:
    Oct 18, 2014
    Posts:
    6
    myCurrentTime, what this? How to know current animation time?
    Third parameter in Animator.Play() set the time, but how to play rewind (set speed to -1)?
     
  4. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    ah you want to play the clip in rewind mode, sorry I misunderstood your question.

    You can only set the Animator state speed in the editor. So if you need to play a clip both in forward or rewind mode you need to create two different state with the same clip and set state's speed to 1 and -1.
     
  5. loover

    loover

    Joined:
    Oct 18, 2014
    Posts:
    6
    How to add event only to reversed clip (which copied from forward speed clip)?
     
  6. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    I'm not sure I understand the question, You would like to add animation event only on the reverse clip? since it the same clip but only played in reverse it should fire the same animation events but in reverse order
     
  7. loover

    loover

    Joined:
    Oct 18, 2014
    Posts:
    6
    Is it possible to add and remove event programmatically?
     
  8. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
  9. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    402
    You guys are fantastically helpful!