Skip to content

Instantly share code, notes, and snippets.

@annakrasner
Created April 13, 2025 16:23
Show Gist options
  • Select an option

  • Save annakrasner/321d3b8ac7c2a75b9fd5b2ab173661d6 to your computer and use it in GitHub Desktop.

Select an option

Save annakrasner/321d3b8ac7c2a75b9fd5b2ab173661d6 to your computer and use it in GitHub Desktop.
Godot 4.4 HTML5 exort mouse capture workaround - attach this script in a separate node.
extends Node
func _input(event):
if Input.is_action_just_pressed("mouse_capture"):
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
if Input.is_action_just_pressed("mouse_release"):
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
@annakrasner
Copy link
Author

Also create input maps for "mouse_capture" and "mouse_release"

@annakrasner
Copy link
Author

Forgot to source: I got it from this thread: godotengine/godot#18369

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment