Godot Version
4.6.2
Question
I am attempting to make a mini application that shakes your mouse by adding and subtracting from it’s position randomly. My question is, how do i make a mouse_warp() function that works properly whilst focused on any window? right now, once i click off of the root scene, my mouse goes to a corner and stays there.
code for reference:
var CurrentLevel = 5.0
var TemporaryScreenOrigin = Vector2i(0,0) - get_tree().get_root().position
var TemporaryMousePosition = DisplayServer.mouse_get_position()
get_tree().get_root().warp_mouse(TemporaryScreenOrigin + TemporaryMousePosition + Vector2i(randi_range(-CurrentLevel,CurrentLevel),randi_range(-CurrentLevel,CurrentLevel)))