Search Issue Tracker

Won't Fix

Votes

5

Found in

5.6.0b10

Issue ID

888440

Regression

No

[OSX] Input.GetAxis(Mouse) first given value is wrong after Cursor.lockState is set to CursorLockMode.Locked

Input

-

How to reproduce:
1. Open the attached "New Unity Project 4" project and open "Main" scene
2. Enter playmode
3. Move the mouse to the corner of your screen, the movement in X will be output to the console
4. Press Space button to lock the mouse at the center of the game window
5. Move the mouse slightly

Expected result: Input.GetAxis("Mouse X) returned value is small, since mouse is moved only slightly from center
Actual result: Input.GetAxis("Mouse X") returns a big value, as if movement value would be returned from wherever the mouse cursor were, before it was locked to the center of the game window

Reproduced on 5.4.5f1, 5.5.2p2, 5.6.0f1, 2017.1.0a3

Notes:
1. Issue only happens with first returned value, after setting Cursor.lockState to Locked, the rest of the values seem correct
2. Couldn't reproduce this on Windows 10

  1. Response avatar

    Resolution Note:

    We are deprecating old input system bugs as we have moved all resources to the new input system.

Comments (3)

  1. 213b8642f646fcc1692b689dc2818a0e?d=mm

    Slatey

    Aug 23, 2021 01:51

    Where is this bug now? I just came across the problem in 2021.1.17f on OSX, no issue on Windows 10.

  2. 3570c609446f8e454a446a5ffff3b86e?d=mm

    oobartez

    Sep 21, 2019 10:55

    Two and half years later the bug is still here.

  3. 5e475c98eb8bffa21b8644f4f80af863?d=mm

    fredsa

    Oct 02, 2017 21:28

    Based on testing on OSX:
    - When the mouse is locked (by setting `Cursor.lockState = CursorLockMode.Locked`), the mouse position is immediately updated so that the mouse cursor is now in the center of the game view, although it likely won't see this until the cursor is subsequently unlocked (by setting`Cursor.lockState = CursorLockMode.None`), at which point you'll notice that your mouse position has jumped.
    - It seems that `Input.GetAxis("Mouse X")` and `Input.GetAxis("Mouse Y")` fail to take this jump into account, so that the first one or two result values of `Input.GetAxis()` are off, based on how far of a virtual jump the mouse made

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.