i’m having trouble changing the value of a Keyframe’s inTangent or outTangent at runtime.
Is there a method to change a keyframe’s tangents without deleting/re-adding the keyframe?
i’m having trouble changing the value of a Keyframe’s inTangent or outTangent at runtime.
Is there a method to change a keyframe’s tangents without deleting/re-adding the keyframe?
static function MakeLinearCurve(c : AnimationCurve){
for(i = 0; i < c.length-1; i++){
k1 = c.keys[i];
k2 = c.keys[i+1];
k1.outTangent = (k2.value - k1.value) / (k2.time - k1.time);
k2.inTangent = (k2.value - k1.value) / (k2.time - k1.time);
c.RemoveKey(i);
c.AddKey(k1);
c.RemoveKey(i+1);
c.AddKey(k2);
}
return c;
}
i dont like it
but it works.