Animation stops to slow

To whom it is reading this post of my, I have but a quick question and was wondering if anyone could help me figure it out. You see I have writing a extremely simple script that pretty much plays an animation while the player is moving Horizontal/Vertical.

I’ll explain why I am doing this, you see I wasn’t able to figure out how to get the third person control system working the way I had intended, mainly I was having problems changing the camera position. Anyway I figure that if I used the first person camera and move it to the third person camera position that I was looking for then all I have to do was simple change the ‘Mouse Look’ at script Y sensitivity to 0.

However the problem that arose from this was the fact that the FPS control system didn’t have anything in place to play animations, hence why I had to make my own script. The problem however is that once the player stops moving, the animation will keep going for a few seconds (about 3 to 4) while it finishes out the the running animation. I was wondering if there was a way that the animation will completely stop, regardless of what stage of it is at.

function Update () 
{
    if (Input.GetAxis("Horizontal") || Input.GetAxis("Vertical"))
    {
    	animation.CrossFade("run");
   	
	}
	else
	{
		animation.CrossFade("idle");
	}
}

I hope that whomever it is reading this understands what it is that I am actually saying. If you could give any help, that would be great.

Go dtí an chéad uair eile, slán leat

try this. crossfading is moving armature bones to new position in a smooth transition. to stop it, use

animation.Play("idle")

not

animation.CrossFade("idle")