I'm sure it could be a simple problem but I'm having trouble with blending my animations in my models together. I've got some models with animations which my artist gave me from maya, and I've set up the different cycles in the inspector.
What happens though is when I want to change the animation of the object, the animation doesn't finish its cycle properly (e.g. the arms and legs are out of position when going from the walk to idle animation).
I'm declaring the animations in the Start() function as below.
function Start()
{
if(target == null && GameObject.FindWithTag("Player"))
{
target = GameObject.FindWithTag("Player").transform;
}
animation.wrapMode = WrapMode.Loop;
animation.Play("Idle");
animation["Walk"].wrapMode = WrapMode.Loop;
}
And declaring them as below
function ChasePlayer()
{
//print ("Chasing Player");
animation.CrossFade("Walk");
dir = target.transform.position - transform.position;
dir = dir.normalized;
transform.Translate(dir * speed * 5 * Time.deltaTime, Space.World);
}
Basically what happens exactly is when there is a call to switch animation, the body parts that need to move for the new animation become animated, but the parts that are not animated become frozen in the position they were at when the animation gets changed. Anyone know where the problem is?