Animation Help

So I have a simple run animation, frames 1-25, and idle is 0-0. I tell it to run and everything plays fine however when I stop running it will not go back to the idle where my character is looking straight ahead. It will pause like, mid animation and stuff. Any ideas :?

I wasn’t aware that frame 0 was even allowed. I assumed that frames had to start at 1… that may be it, but I can’t guarantee it’s the right answer, as I’ve never tried myself.

When you stop running, do you tell it to play the Idle animation again?

It would be easier to help you if you posted part of your script.

function Update ()
{
	animation.wrapMode = WrapMode.Loop;
	
   if (Input.GetAxis("Vertical") > 0.2)
	animation.CrossFade("walk"); 
		
		else{ 
		//animation.Stop(); 
		animation.CrossFade("idle"); 
				} 
	  }

Sorry internet had messed up and didnt load it. Its very simple, nothing fancy

Ah! Seems the problem is with the one frame Idle animation.

You might need to insert an extra frame so your Idle is frames 0-1 instead. A lot of engines don’t deal well with animations that start and end on the same frame, I’m guessing Unity is the same.

It might be the frame number, but it might also be because his idle pose doesn’t have itself keyframed (Unity needs the idle pose to have keyframes on it’s bones otherwise Unity won’t be able to switch it back).

To fix, simply keyframe the bones at the idle pose in your 3d graphics package. This will then tell Unity that there are keyframed values for the bones on idle and Unity can switch to them.

oo thank you!! :smile: ive been dealing with it for weeks and never thought of that. I assumed it must have been some kind of scripting error or something but I tried many scripts and they still did not work. Thank you all 8)