Hey there, I’ve been struggling with this for the better part of an hour and I figured I’d post here before I go to sleep.
In unity I have RightHorizontal and RightVertical bound to Joystick axis 4 and 5 accordingly, see here:
I have these set up with a script using
float rightMoveHorizontal = Input.GetAxis("RightHorizontal");
float rightMoveVertical = Input.GetAxis("RightVertical");
and also using
Debug.Log("Right Stick --- Horizontal: " + rightMoveHorizontal + ", Vertical: " + rightMoveVertical);
to read the inputs. When the debug statement outputs, it always outputs negative 1 for horizontal, and 1 for vertical (assuming 1 because I have invert checked on RightVertical. )
When I push my right stick all the way to the right, horizontal turns straight from -1 to 1, with no decimals (as opposed to the left stick, which has decimals.) the same happens when pushing the right stick all the way down, vertical turns to -1.
My left stick works fine in unity, and my right stick works fine in any other games I’ve played, as well as http://html5gamepad.com/ which I just used to test if my stick was broken.
I’ve seen this asked in the forums a few times but no one ever has an answer, so hopefully I can be that one post that people find in google when they have a problem.
Thanks in advance!
P.S.
It’s really tough to google “-1”, which is why I substituted one of my -s for the word negative and tried to use descriptive language. Hopefully someone will find this in the future.
Edit: after significantly more hours of screwing around with the inputs, it turned out to be a driver I had installed for gamecube controllers called “vjoy”, changing the Joy Num to something other than 2 (which was the vjoy input number at the time) fixed it, but I also uninstalled vjoy to get around this.
I’m assuming that 4 is the triggers on the vjoy version of the xbox inputs, and that’s why it was only returning -1 or 1.