Input.GetAxis returning only -1, 0 or 1, nothing between

I’m trying to use a PS3 controller (though the MotioninJoy Tool, so it appears like an Xbox 360 controller) and everything is working fine, except the joysticks are only offering three values: -1, 0, 1. My problem: I want a half-push to trigger 0.5, a quarter to trigger 0.25, etc. I believe the docs say they’re supposed to work this way, so I’m not sure what I’ve done wrong.

Here’s the code (the only bit which listens for the joystick input) and prints it:

function Update () {
	
	Debug.LogWarning("J1V: "+Input.GetAxis("J1V"));
	Debug.LogWarning("J1H: "+Input.GetAxis("J1H"));
	Debug.LogWarning("J2V: "+Input.GetAxis("J2V"));
	Debug.LogWarning("J2H: "+Input.GetAxis("J2H"));

}

I mapped J1V to the left joystick’s vertical axis and the others according to the stick and axis, accordingly. (Hence than name “1V”, mapped via Edit->Project Settings->Input, mapped “J1V” as Type:Joystick Axis, Axis: Y axis, Joy Num: Get Motion from all Joysticks.)

I know that it works since these warnings do print, but they print only print -1, 0 and 1. Actually, instead of 0 they print 0.0142733. Not sure if it matters, but worth noting.

Any ideas of what could be causing my scale to intermediate values? Thanks!

So does the motionInJoy force the values to like .25 and .5 like you were saying? Are you getting .01427 for when it should be 0? That's pretty darn close sounds like your joystick might be a little off or maybe that kind of precision difference is normal? Unfortunately I never used joysticks yet so I can't help you but it sounds like your scripts are not set up to differentiate the various input phases? It's only detecting the full direction not any of the middle ground? Impossible to help without seeing more code I think. Maybe someone else knows though.

1 Answer

1

Got the answer from somewhere else:

Turned out the input settings scale needed to be changed. I thought the defaults of the Gravity was 1000, Dead was 0.001 and Sensitivity was 1000. Someone has me change them to Gravity = 0, Dead = 0.19 and Sensitivity = 1 and things started working. I’m now playing with each, but this was my problem.