I have a problem with MOUSE_MODE_CAPTURED!

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By veselin

So this is the line that is making problems for me:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)

I have it in my _ready() function and the cursor does get hidden but the mouse stops detecting movement!

After that in my _process(delta) function I have these lines to show the cursor again…:
if Input.is_action_just_pressed(“ui_cancel”):
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)

…and when I press escape the cursor shows up and the mouse movement starts getting detected once again!

So my question is: is this a bug or am I doing something wrong, because from what I know if I want to hide the cursor, stop it from escaping the viewport and still detect movement I have to use exactly Input.MOUSE_MODE_CAPTURED?

I have the same problem. Have you figured it out?
UPD. I’m detecting mouse movement and noted that event.speed does not work with this mode, but event.relative does and is pretty much the same (but probably should be multiplied by delta).

GreyMiller | 2020-09-01 10:24