Animation Interpolation Jerk

This post is in regards to a problem posted on Unity Japan’s blog and is related to animation interpolation.

Reference : http://japan.unity3d.com/blog/?p=290

There is a sample Unity project at the bottom of the blog illustrating the problem, and 1 fix for it called an “AnimationLatch”.

The project has a camera that animates around a block from 2 locations.

Basically the problem is that when the camera interpolates from location 1 to location 2 (or vice versa) there is a noticeable “jerk”.

There is a slider control in the upper left corner of the screen that lets you control the speed.

(Slow it down to see the interpolation jerk better)

I am currently seeing this problem in a game project I am working on. I am looking for another way to fix it.

I wanted to ask if anyone else has ever had to deal with this problem and if there is a better solution than the “AnimationLatch” method.

Not sure if it matters but the art production team is using Maya to create the animations for our game.

I have encountered that many times.

I have tried 3 workarounds, you can check if any fits your need.

  1. raise sample rate ( not very practical )
    Considering how the interpolation is done, if you raise the sample rate from 60 to 6000, this could lower the jerk chance
    Not a very good method, don’t use it :slight_smile:

  2. use AnimationEvent to jump over the gap
    if we have a abrupt change of camera rotation at the gap of 49 frame and 50 frame.
    then you could add an animation event at 49frame to change the time to 50frame;

  3. use two cameras;
    assume we’re using cam1 from frame1~49, then at frame 49 we disable cam1 and enable cam2; (cam2 should be at the pos of the cam1 at frame50)
    at frame50, we enable cam1 and disable cam2;

EDIT:
The method in the blog looks better than all others, he uses a script to save the rotation at OnEnable and apply to cam at LateUpdate() at the frame with abrupt change, Hmm, I think I will use it instead.