可能是由于Blender和Unity的坐标系不同所致,对应的解决方案是要在Blender中将模型的动画应用于整个模型,然后将导出格式设置为FBX并确保选择右向前(right-forward)选择,最后在Unity中使用两个脚本来解决问题。第一个脚本是为了将FBX模型中的动画转换为Unity可以识别的动画格式,第二个脚本用于将FBX模型的动画应用于Unity中的模型:
using UnityEngine;
using System.Collections;
public class AnimationImporter : MonoBehaviour {
public AnimationClip[] anims;
void OnValidate() {
foreach (AnimationClip anim in anims) {
anim.legacy = true;
}
}
}
using UnityEngine;
using System.Collections;
public class AnimationApplier : MonoBehaviour {
public AnimationClip[] anims;
public Animator targetAnimator;
void Start() {
Animation targetAnimation = targetAnimator.GetComponent();
foreach (AnimationClip anim in anims) {
AnimationClip clonedAnim = Object.Instantiate(anim);
targetAnimation.AddClip(clonedAnim, anim.name);
targetAnimation[anim.name].legacy = true;
targetAnimation[anim.name].enabled = true;
targetAnimation.Play(anim.name);
}
}
}