- Home /
Walking animation has wrong rotation
Hello,
I want to change between 2 animations for an FPS game (walking - running) but there is one problem.
When I walk, the "walking" animation plays just fine. When I tun, the "running" animation plays fine as well. But when I go back to walking again, it only plays the "walking" animation on the rotation from the previous animation, "running". In other words, it doesn't return to the first rotation.
Any help?
This is my scrip so far:
#pragma strict
var running : boolean;
function Update () {
if( (Input.GetAxis("Horizontal") || Input.GetAxis("Vertical")) && !running )
{
animation.Play("Walking");
}
else if( (Input.GetAxis("Horizontal") || Input.GetAxis("Vertical")) && running )
{
animation.Play("Running");
}
if(Input.GetButton("Run"))
{
running = true;
}
else
{
running = false;
}
}
Comment
Your answer
Follow this Question
Related Questions
Zooming animation doesn't work 1 Answer
Why is Animation Not Playing in Reverse? 2 Answers
Animation/CrossFade difficulties, Animation won't CrossFade 0 Answers
Playing several animations 1 Answer
how to mix animations for a fps? 1 Answer