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

Updating Animation By Frames

Discussion in 'Animation' started by kconnors2165, Dec 11, 2013.

  1. kconnors2165

    kconnors2165

    Joined:
    Dec 11, 2013
    Posts:
    2
    I have an object that has an Animator attached to it, and attached to the animator is a animation controller that only has one animation state inside it. What I'm trying to do is play that animation at the beginning of my application's startup, my object starts at 0.0 time, and with every frame, it is set to a specific value within that animation. For example: I have a 5 second animation, and I want to play that animation over 6 frames, so every frame I would set the current "animation time" to that frame number. (In this case, frame 1 is 0.0s, frame 2 is 1.0s, frame 3 is 2.0s, etc.)

    Now what I have just given you is strictly an example, so that means that this animation isn't always going to be 5 seconds long and I won't always want it to update over 6 frames.

    I hope someone can help me with this, and thank you for helping out in advance.
     
  2. kconnors2165

    kconnors2165

    Joined:
    Dec 11, 2013
    Posts:
    2
    I managed to come up with a way to do this. What I did was use the animation duration, my requested fps and delta time to figure out the Animator.speed variable and update that to interpolate properly.
     
    Last edited: Dec 12, 2013