Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Animation reversal

Discussion in 'Animation' started by kdarius43, Aug 8, 2018.

  1. kdarius43

    kdarius43

    Joined:
    Mar 16, 2015
    Posts:
    140
    Hello all I have had this issue that has been bothering me. I can hard code it and fix the problem but wanted to see if there was an easier ways. Say i have a cube that i have and animator on and and an animation. This animation goes from 0 - 100 in scale. I have another animation attached to the cube that goes from scale 100 - 0. When the cube is clicked it sends trigger to the animator to play the opposite animation. The issue i have is if the cube is animating from 0 - 100 and it is at 63 and someone clicks it again the other animation is triggered. The issue with this is instead of it going from 63 - 0 it just instantly to 100 and start going back to zero. I was wondering if there was a way to fix this in animator and animations and not have to code it in.
     
  2. TantzyGames

    TantzyGames

    Joined:
    Jul 27, 2016
    Posts:
    50
    Try using transitions instead of animation clips.
    1. Create one clip of the cube at 0, and one clip of the cube at 100.
    2. Create a transition to each clip from "Any State".
    3. Set a parameter to trigger each transition.

    Something this simple would probably be much simpler just to use lerp in a script, but this method could be useful for more complex animations.