- Home /
Aligning tangents with AnimationCurve
When I add new key to AnimationCurve with a curve editor, it does not affect the curve line:
Tangents are nicely aligned with the curve. Adding new key doesn't change curve's shape.
But when I add the same key at exact same timestamp and value using script, the curve's shape gets distorted. It's because both tangents have different values:
How can I align tangents with the curve the same way as curve editor does?
[EDIT] Script used to generate the second curve:
private void Reset() {
curve = new AnimationCurve();
var key0 = new Keyframe(0, 0, 0, 75);
var key1 = new Keyframe(1, 1, 0.7f, 0);
curve.AddKey(key0);
curve.AddKey(key1);
var valueAtTime = curve.Evaluate(0.142f);
curve.AddKey(0.142f, valueAtTime);
}
Answer by Liujianhan · Jun 28, 2015 at 01:13 PM
I want too,seems need caculate the tangent at insert point
Your answer
Follow this Question
Related Questions
Animating key on AnimationCurve in real time 0 Answers
Undocumented property: Keyframe.tangentMode 3 Answers
Change Colider to Raycast instead? 2 Answers
Sound on keypress, not working 2 Answers
key remaping menu 0 Answers