How can i stop the Xbox joystick moving from the centre position.
i have tried something like this:
float x = Input.GetAxis("Mouse X Xbox");
if( x < 0.1 && x > -0.1)
{
x = 0;
}
How can i stop the Xbox joystick moving from the centre position.
i have tried something like this:
float x = Input.GetAxis("Mouse X Xbox");
if( x < 0.1 && x > -0.1)
{
x = 0;
}
I think you might be using the wrong operator. Have you tried it with || instead of &&?
I’d start with just doing a Debug.Log() of the value that GetAxis is giving you. The code you posted should do exactly what you want, so my next thought would be bad data. Things that come to mind:
Another thing to consider is an error elsewhere. Did you remember to use x later on in the program, or are you still reading from GetAxis directly? etc.
You are best to utilize the Input Manager and setting the Deadzone to 0.2 (this is usually pretty good for the sticks natural drift), and 0.1 for the triggers if they are giving you an issue.