Search Issue Tracker

Fixed in 5.1.0

Votes

0

Found in

4.2.0f4

Issue ID

559723

Regression

No

AnimationCurve created by script has a very steep transition

Animation

-

When creating an animation by code (add KeyFrame to AnimationClip then finally add AnimationClip to Animation and Play() ) if making a keyframe for "rotation" you will get a special keyframe that will have a sharp broken at the middle of 2 keyframes.

2) How can we reproduce it using the example you attached
Try this on a GameObject that has Animation component attached

AnimationClip dieAnimation = new AnimationClip();
AnimationCurve rotationCurve = new AnimationCurve();
rotationCurve.AddKey(new Keyframe(0.5f,0.3f,0,0));
rotationCurve.AddKey(new Keyframe(1,0,0,0));
dieAnimation.SetCurve("",typeof(Transform),"localRotation.z",rotationCurve);
animation.AddClip(dieAnimation,"dieAnimation");
animation.Play("dieAnimation");

At runtime check the newly created AnimationClip in the Animation Editor to see that the light-blue keyframe belongs to localRotation.z has a very weird shape. Try drag around for a weirder shape. (If the two are really close, the shape will be ok)

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.