Ensure transforms of last animation frame are set

I have some animations playing and it seems like there is no guaranteed that the last frame of the animation is guaranteed to be set, ie: The transforms of the last frame of an animation are not the same after playing the animation over 50 times. There is sometimes the remains of a last little bit of lerping.

Is there a workaround ? I have tried clamping, wrapping, etc.... It would be nice to get the transforms out of the animation itself but unity doesnt expose that it seems

I believe you must use `Animation.Sample()` to reliably read out animation transformations.

Setting ClampForever should help also.

Unity 3.2 should fix this issue (at least when playing a single animation), IIRC.

I tried what you said and am calling animation.sample(), Namely I have an animation named sample() which plays for .2seconds, and then in code when .3s has passed, this code runs:

Animation anims = (Animation)GunObject.GetComponent(typeof(Animation));
anims.Stop();
anims["shoulder"].normalizedTime = 1;
anims["shoulder"].clip.EnsureQuaternionContinuity();
anims["shoulder"].enabled = true;
anims.Sample();
anims["shoulder"].enabled = false;

And I still find the transforms are off almost 40% of the time, and by off that means they are different, so calling .sample() doesnt do much in terms of 'setting' a models transforms from a particular time of animation. It HAS to be doing some blending of something. Also, clampforever shouldn't matter cause im trying to simply set the object's transforms at a particular animation time, but I did try it and no change either