- Home /
CursorLockMode.Locked not correctly centering cursor
I’m developing a demo for Oculus Rift on Unity 5.2.1 (Virtual Reality enabled is enabled) and need to have the cursor locked to the center of the screen.
I know I can achieve this with Cursor.lockState = CursorLockMode.Locked
– which kinda works, if it weren’t for the fact that the cursor isn’t placed placed in the center, but somewhere above the actual center of the screen.
Red lines mark the actual center, the cursor shows where Unity locks the cursor in.
Anyone has an idea what is going on here?
Update: ScreenToViewportPoint correctly, but only vaguely helpful reports that the cursor is, indeed, at 0.5, 0.6, 0.0.
Can Someone Answer this please? I have the same problem....
Answer by joedurb · Dec 06, 2018 at 09:04 PM
Confirmed still a problem in 2018.2.5f1
For me it seemed like they are centering the mouse cursor on the BOTTOM LEFT of the cursor icon, Rather than the TOP LEFT.
The clicking Position ends up being above the center roughly the size of mouse pointer.
OnMouseClick is rendered completely buggy by this. Workaround was using a RayCast instead from center of screen.