- Home /
Problem when adding a keyframe that involves rotation
I am trying to add a new keyframe by changing rotation yy axis from 180 (time 0) to 220 (time 1) by using this:
// my animation
public AnimationClip _newAnimation;
// all curves from my animation
all_curves = AnimationUtility.GetCurveBindings(_newAnimation);
foreach (var binding in all_curves) {
// when Rotation.y is found, then create a new keyfram
if (binding.propertyName.Equals("m_LocalRotation.y")) {
AnimationCurve curve = AnimationUtility.GetEditorCurve(_newAnimation, binding);
curve.AddKey(1.0f, 220.0f);
AnimationUtility.SetEditorCurve(_newAnimation, binding, curve);
}
}
However the values are not working properly:
The y rotation value isn't 220, but 90 instead. Already played with this options:
Any suggestions?
Thanks.
fig1.jpg
(71.4 kB)
captura-de-ecra-032816-053349-am.jpg
(34.2 kB)
Comment
Sounds like you want to be working in Euler. Quats are not so straightforward to modify. I always had to click Off the record button for my window to behave properly.
Your answer
Follow this Question
Related Questions
Rotating animation rotating backwards 360 degrees 0 Answers
Is there a way to make keyframes of an animation conditional? 1 Answer
Rotate a box 90 degrees with Root Motion 0 Answers
Tank Wheels and Treads 1 Answer
Legacy Animations ignore Rotation 0 Answers