Hi,
When Creating a new AnimationClip from another one by just copying the AnimationCurves over, the timings of the Positions are slightly offset while Rotation and Scale stay the same.
Here is the Code I use to what should be just copying an AnimationClip (The idea is to eddit the animation in this process in the end):
[MenuItem("Assets/ReconstituteAnimation")]
private static void ReconstituteAnimation()
{
AnimationClip clip = (AnimationClip)Selection.activeObject;
AnimationClip newClip = new AnimationClip();
foreach (var binding in AnimationUtility.GetCurveBindings(clip))
{
var curve = AnimationUtility.GetEditorCurve(clip, binding);
newClip.SetCurve(binding.path, binding.type, binding.propertyName, curve);
}
string clipPath = AssetDatabase.GetAssetPath(clip);
string newClipPath = clipPath.Substring(0, clipPath.Length - 5) + "Reconstituted.anim";
AssetDatabase.CreateAsset(newClip, newClipPath);
AssetDatabase.SaveAssets();
}
[MenuItem("Assets/ReconstituteAnimation", true)]
private static bool ReconstituteAnimationValidation()
{
return Selection.activeObject is AnimationClip;
}
And here are the Original and Resulting Animation viewed in the Animation Window:
Original:
Reconstituted:
Anybody got an Idea whats going on here? Can anybody else reproduce this behaviour?