From 9b38e04fff3e05a57dfa166b089ff68d05c5f2d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=A1=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2?= Date: Tue, 12 Oct 2021 23:26:03 +0300 Subject: [PATCH] Exposed setters for sensor values in Input class --- core/input/input.cpp | 4 ++++ doc/classes/Input.xml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/core/input/input.cpp b/core/input/input.cpp index f9a361c7617..296aa1f071c 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -117,6 +117,10 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("get_accelerometer"), &Input::get_accelerometer); ClassDB::bind_method(D_METHOD("get_magnetometer"), &Input::get_magnetometer); ClassDB::bind_method(D_METHOD("get_gyroscope"), &Input::get_gyroscope); + ClassDB::bind_method(D_METHOD("set_gravity", "value"), &Input::set_gravity); + ClassDB::bind_method(D_METHOD("set_accelerometer", "value"), &Input::set_accelerometer); + ClassDB::bind_method(D_METHOD("set_magnetometer", "value"), &Input::set_magnetometer); + ClassDB::bind_method(D_METHOD("set_gyroscope", "value"), &Input::set_gyroscope); ClassDB::bind_method(D_METHOD("get_last_mouse_speed"), &Input::get_last_mouse_speed); ClassDB::bind_method(D_METHOD("get_mouse_button_mask"), &Input::get_mouse_button_mask); ClassDB::bind_method(D_METHOD("set_mouse_mode", "mode"), &Input::set_mouse_mode); diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index 00ead311159..88e4a676154 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -269,6 +269,14 @@ Removes all mappings from the internal database that match the given GUID. + + + + + Sets the acceleration value of the accelerometer sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC. + [b]Note:[/b] This value can be immediately overwritten by the hardware sensor value on Android and iOS. + + @@ -291,6 +299,30 @@ [b]Note:[/b] This method generates an [InputEventMouseMotion] to update cursor immediately. + + + + + Sets the gravity value of the accelerometer sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC. + [b]Note:[/b] This value can be immediately overwritten by the hardware sensor value on Android and iOS. + + + + + + + Sets the value of the rotation rate of the gyroscope sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC. + [b]Note:[/b] This value can be immediately overwritten by the hardware sensor value on Android and iOS. + + + + + + + Sets the value of the magnetic field of the magnetometer sensor. Can be used for debugging on devices without a hardware sensor, for example in an editor on a PC. + [b]Note:[/b] This value can be immediately overwritten by the hardware sensor value on Android and iOS. + +