Walking Animation Issue

Not sure if I posted this in the right forum.

My issue is that whenever I hold down my right mouse button my character stops moving but it still plays the walk animation. Is it due to this script being too simple?

function Update ()

{

if (Input.GetAxis(“Vertical”) > 0.2)

animation.CrossFade (“walk”);

else

animation.CrossFade (“idle”);

}

Or is it due to some other weird issue? No matter what I have tried it has all failed.

use a Debug.Log(Input.GetAxis(“Vertical”)) and check you log. See if pressing the rmb is actually stopping movement in the computer’s “eyes.”
Maybe, it still calculating vertical movement as being greater than 0.2, even though the NPC looks like it stopped to you, if that makes sense.

Perhaps check for input. Not sure which method your using, but for keyboard I would throw in a parented if statement checking for a GetKey of “w”