Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Animating Incremental Rotation

Discussion in 'Animation' started by Recluse, Mar 26, 2014.

  1. Recluse

    Recluse

    Joined:
    May 16, 2010
    Posts:
    485
    I've just recently started using Unity's animation editor to effect translations and rotations that I'd normally do through script.

    I've just hit a bit of a stumbling block though.

    I have a platform, which I want to rotate in 90 degree increments whenever the player lands on it.

    Now I can't find any way to effect this in the animation editor - the animation clip turns the platform from 0 to 90 degrees and then loops back to 0 again.

    The solutions I can think of are not ideal:

    1) Use 4 different animation clips (0-90, 90-180, 180-270, 270-360) to rotate the platform 90 degrees each time. This is not an elegant solution and would require some scripting to step through the stages.

    2) Make the platform a child of another transform, and snap this to 90 degree increments each time the animation plays using a script - this is self defeating, as I may as well just script the entire thing + it may cause jitter.

    Is there a way to do incremental animation, or must this be scripted?
     
  2. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    900
    Just learn how to use any of the freely available tweening engines here on the forum, I personally support and suggest Hotween. Doing what you have outlined is a breeze in Hotween and it has many callbacks you can hook into and you can also use any of the known interpolation curve algorithms or iirc even use unities animation curves as a ipo input.

    I Can understand using the animation editor for putting together a quick complicated camera fly through , but for doing simple rotations and translations on many objects it would be very cumbersome...