- Home /
GetAxis Mouse X and Mouse Y returning high number values.
The getaxis of my Mouse X and Y are returning values greater than 1 and smaller than -1. Numbers as great as 9 in fact. Anyone have any idea why?
Answer by Eno-Khaon · Oct 23, 2020 at 04:20 AM
GetAxis() for mouse inputs returns the number of pixels the mouse moved between the previous and current frame. Whether the value is positive or negative dictates the direction the mouse moved to provide that input (-X/X for left/right, -Y/Y for down/up respectively).
As a result, it wouldn't be strange at all for the mouse to move 9 pixels on a given axis in a single frame when moved quickly.
Sorry I forgot to mention I’m using a DualShock 4 not a mouse. The right analog is acting as mouse. According to the scripting api the ds4 right analog Axis should return values between 1 and -1.
Well, if you're using a controller, but the Input scheme is still based on "mouse" control (and/or the analog stick on the controller moves the mouse cursor in general), then it would still make sense for input to behave in that manner.
Basically, if the controller moves the mouse cursor, then checking for "mouse" input in Unity would still give the same result of that input. If the controller moves the mouse cursor, then it doesn't seem weird that it would be reflected by that output.
If you're using GetAxis() for "joystick" input (and the controller isn't incompatible for any reason, driver-based or whatever), then the resulting values should range from -1 to 1 instead.
Your answer
Follow this Question
Related Questions
GetAxis for MouseX for web player. 0 Answers
How to put limits in Z? 0 Answers
Detecting cross platform input? 0 Answers
Mouse event build up? 0 Answers
Input.GetAxis with MouseMovement 0 Answers