You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Windows 10, NVIDIA GeForce GTX 1660 Ti, Forward Plus
Issue description
When using a SubViewport and changing the mouse mode between MOUSE_MODE_CAPTURED and MOUSE_MODE_VISIBLE, it will not detect any mouse inputs unless a mouse button is held down.
This also happens when alt-tabbing and the cursor is outside of the window, but only after the mouse modes have been switched at least once.
Create a new 3D project
Set the project to run in fullscreen
Add a SubViewportContainer and a SubViewport, set to fill the whole screen
Add a player character with basic mouse movement and a camera
Add a way to switch mouse modes between visible and captured
Add a box in front of the player for reference when moving the mouse
Run the project, change the mouse mode to visible, move the cursor outside of the window (bottom left), then change the mouse mode back to captured.
Also, @MikaSchoenmakers have you found a workaround?, currently I'm trying this:
when the window gets focused again (I connected to the window.focus_entered signal), I set the mouse_mode to Input.MOUSE_MODE_VISIBLE for some frames and then I change it back to Input.MOUSE_MODE_CAPTURED again.
Seems like it should be a common issue for games where you directly control characters and you are using viewports for full screen shaders. Surprised this doesn't have more thumbs!
My work around, on an Autoload singleton
func _notification(what):
if what == NOTIFICATION_APPLICATION_FOCUS_IN:
fix_mouse_input()
func fix_mouse_input():
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
await get_tree().process_frame
await get_tree().process_frame
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
theludovyc
pushed a commit
to theludovyc/unknown-horizons-godot-port
that referenced
this issue
Jul 11, 2024
Godot version
4.1.1
System information
Windows 10, NVIDIA GeForce GTX 1660 Ti, Forward Plus
Issue description
When using a SubViewport and changing the mouse mode between MOUSE_MODE_CAPTURED and MOUSE_MODE_VISIBLE, it will not detect any mouse inputs unless a mouse button is held down.
This also happens when alt-tabbing and the cursor is outside of the window, but only after the mouse modes have been switched at least once.
Video:
https://github.com/godotengine/godot/assets/95089122/5e2d76ad-9120-43b6-9fa4-bb4170833699
First the mouse is working fine, then I switch to MOUSE_MODE_VISIBLE, move the cursor outside of the window, switch back to MOUSE_MODE_CAPTURED, then mouse inputs are no longer working unless I hold down left click.
Might be related to #84258, but I'm not sure.
Steps to reproduce
Create a new 3D project
Set the project to run in fullscreen
Add a SubViewportContainer and a SubViewport, set to fill the whole screen
Add a player character with basic mouse movement and a camera
Add a way to switch mouse modes between visible and captured
Add a box in front of the player for reference when moving the mouse
Run the project, change the mouse mode to visible, move the cursor outside of the window (bottom left), then change the mouse mode back to captured.
Minimal reproduction project
MRP.zip
The text was updated successfully, but these errors were encountered: