Playing Animations Using Input.GetAxis

Hi, I’m trying to play animations using the Input.GetAxis as shown in the scripting reference. My character moves around the screen just fine but I cannot get the animations to play how I want them to. He has an animation for moving up and one for moving down, but when using “Mathf.Abs(Input.GetAxis(“Vertical”))” the input is listed as a scale from 0 - 1, making me unsure how to play an animation for up and down.

If the “Mathf.Abs(Input.GetAxis(“Vertical”))” was from -1 - 1 this would work great but it doesn’t. I need this to work with Mobile which is why I am using GetAxis. Any help would be appreciated. Thanks.

		if (Mathf.Abs(Input.GetAxis("Vertical")) > 0.1F)//works
		animation.CrossFade("move_up");
	    if (Mathf.Abs(Input.GetAxis("Vertical")) < 0.1F)//doesn't work
		animation.CrossFade("move_up");

I am using C#.

Remove Mathf.Abs? You are taking the absolute value of the input, so it is only ever going to be 0-1. Input.GetAxis returns from -1 to 1. Also make the second condition check that the input is less than -.1f

Also, it looks like it’ll be playing the same animation either way. Both cases play (“move_up”).