diff --git a/core/input/input.cpp b/core/input/input.cpp index eba7ded267b..016c898aac2 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -136,6 +136,7 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("set_mouse_mode", "mode"), &Input::set_mouse_mode); ClassDB::bind_method(D_METHOD("get_mouse_mode"), &Input::get_mouse_mode); ClassDB::bind_method(D_METHOD("warp_mouse", "position"), &Input::warp_mouse); + ClassDB::bind_method(D_METHOD("warp_mouse_motion", "motion", "rect"), &Input::warp_mouse_motion); ClassDB::bind_method(D_METHOD("action_press", "action", "strength"), &Input::action_press, DEFVAL(1.f)); ClassDB::bind_method(D_METHOD("action_release", "action"), &Input::action_release); ClassDB::bind_method(D_METHOD("set_default_cursor_shape", "shape"), &Input::set_default_cursor_shape, DEFVAL(CURSOR_ARROW)); diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index 6fe5b7a8022..30b254dc0dd 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -414,7 +414,17 @@ Sets the mouse position to the specified vector, provided in pixels and relative to an origin at the upper left corner of the currently focused Window Manager game window. Mouse position is clipped to the limits of the screen resolution, or to the limits of the game window if [enum MouseMode] is set to [constant MOUSE_MODE_CONFINED] or [constant MOUSE_MODE_CONFINED_HIDDEN]. - [b]Note:[/b] [method warp_mouse] is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web. + [b]Note:[/b] [method warp_mouse] is only supported on Windows, macOS, and Linux. It has no effect on Android, iOS, and Web. + + + + + + + + When the given mouse [param motion] moves the mouse past the boundary defined by the global [param rect], this method warps the mouse to the opposite side of the boundary. For example, this function is used by the 3D editor when orbiting to prevent the mouse getting stuck at the edge, instead the mouse is teleported to the other side of the 3D editor viewport and can continue moving freely in all directions. + This function is wrapper around [method warp_mouse], which will be called when the mouse needs to be warped. The returned value is the corrected relative mouse motion that should be used instead of the original [param motion]'s relative motion. + [b]Note:[/b] Like [method warp_mouse], [method warp_mouse_motion] is only supported on Windows, macOS, and Linux. It has no effect on Android, iOS, and Web.