input.getaxis("horizontal") Question

Hi how do i access which horizontal direction it is going meaning in an if statement

for example i know that the values is between -1 - 1 but dont know how to test for that?

input.getaxis("horizontal")

Thanks :smile:

Just so u guys know i am trying to use it like this

	var target : Transform;
	var target2 : Transform;
	function Update () {


	if(Input.GetAxis("horizontal")  < 1){
	var relativePos = target.position.z - transform.position.z;
	var rotation = Quaternion.LookRotation(relativePos);
	transform.rotation = rotation;
	}
	}



	if(Input.GetAxis("horizontal")  > 1){
	var relativePos2 = target.position.z - transform.position.z;
	var rotation2 = Quaternion.LookRotation(relativePos2);
	transform.rotation = rotation2;
	}
	
	}

Once again thanks for helping

As you said the output is in the interval [-1,1],
so it will never be bigger than 1 / less then -1.

if(Input.GetAxis("horizontal") > 0)
if(Input.GetAxis("horizontal") < 0)

The axis are case-sensitive so also care for that.

ok thanks i though it was something like that and i was on notepad writing that lol don’t have my PC :smile: thanks allot for the quick response.