summaryrefslogtreecommitdiff
path: root/modules/gdnative/nativearvr/arvr_interface_gdnative.cpp
diff options
context:
space:
mode:
authorBastiaan Olij <mux213@gmail.com>2017-11-04 08:57:25 +1100
committerGitHub <noreply@github.com>2017-11-04 08:57:25 +1100
commit25c38c75425e3ccfcaed53ebd38fc588d6f35764 (patch)
tree88e3af7d757376132705070db18afe26731cae3b /modules/gdnative/nativearvr/arvr_interface_gdnative.cpp
parentacd193b62e3972d6dd1e4b2aa115948658f85e9b (diff)
parent167b7b55338761e3cb48677219d41f5bfc32c839 (diff)
Merge pull request #12557 from BastiaanOlij/arvr_add_rumble_support
Adding rumble support to ARVR controllers
Diffstat (limited to 'modules/gdnative/nativearvr/arvr_interface_gdnative.cpp')
-rw-r--r--modules/gdnative/nativearvr/arvr_interface_gdnative.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/gdnative/nativearvr/arvr_interface_gdnative.cpp b/modules/gdnative/nativearvr/arvr_interface_gdnative.cpp
index ff8bda162f..e2a7019fa4 100644
--- a/modules/gdnative/nativearvr/arvr_interface_gdnative.cpp
+++ b/modules/gdnative/nativearvr/arvr_interface_gdnative.cpp
@@ -383,4 +383,16 @@ void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p
}
}
}
+
+godot_real GDAPI godot_arvr_get_controller_rumble(godot_int p_controller_id) {
+ ARVRServer *arvr_server = ARVRServer::get_singleton();
+ ERR_FAIL_NULL_V(arvr_server, 0.0);
+
+ ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, p_controller_id);
+ if (tracker != NULL) {
+ return tracker->get_rumble();
+ }
+
+ return 0.0;
+}
}