I am working with creating animating objects in Unity through the use of AnimationClip and SetCurve. Due to the nature of the program I must use this method. When I use this method on transformations it works perfectly. When I attempt to rotate the object, I get nothing. No movement whatsoever and the Animation Editor shows the keys are there but are completely flat. I have been researching this on the forums, but come up with nothing that works. Here is the code I have been using. Any help is appreciated.
function Start () {
// Create the curve
var curve = new AnimationCurve(Keyframe(0, 0.0f), Keyframe(1, 280.0f));
// Create the clip with the curve
var clip : AnimationClip = new AnimationClip();
clip.SetCurve("", Transform, "localRotation.x", curve);
clip.SetCurve("", Transform, "localRotation.y", curve);
clip.SetCurve("", Transform, "localRotation.z", curve);
clip.SetCurve("", Transform, "localRotation.w", curve);
// Add and play the clip
animation.AddClip(clip, "test");
animation.Play("test");
}
@script RequireComponent(Animation)