diff options
author | Max Hilbrunner <mhilbrunner@users.noreply.github.com> | 2022-10-19 18:18:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-19 18:18:36 +0200 |
commit | 5f7906a289430a9324b0c772b83cc9264fb8ac25 (patch) | |
tree | a5bb7e59ba25d244a70a9f7bbbf7be28fb197293 | |
parent | 61051a44ccacbe447f14538b5bb4b68a62fc896f (diff) | |
parent | 1e7f00949215702e58526bbdfc92e07e0233e08d (diff) |
Merge pull request #67527 from BastiaanOlij/fix_tracker_names
Fix two typos in tracker names and a bug in OpenXR haptic feedback
-rw-r--r-- | modules/openxr/openxr_interface.cpp | 11 | ||||
-rw-r--r-- | scene/3d/xr_nodes.cpp | 4 |
2 files changed, 12 insertions, 3 deletions
diff --git a/modules/openxr/openxr_interface.cpp b/modules/openxr/openxr_interface.cpp index a0504cb510..bdf437b0b7 100644 --- a/modules/openxr/openxr_interface.cpp +++ b/modules/openxr/openxr_interface.cpp @@ -458,9 +458,18 @@ void OpenXRInterface::handle_tracker(Tracker *p_tracker) { void OpenXRInterface::trigger_haptic_pulse(const String &p_action_name, const StringName &p_tracker_name, double p_frequency, double p_amplitude, double p_duration_sec, double p_delay_sec) { ERR_FAIL_NULL(openxr_api); + Action *action = find_action(p_action_name); ERR_FAIL_NULL(action); - Tracker *tracker = find_tracker(p_tracker_name); + + // We need to map our tracker name to our OpenXR name for our inbuild names. + String tracker_name = p_tracker_name; + if (tracker_name == "left_hand") { + tracker_name = "/user/hand/left"; + } else if (tracker_name == "right_hand") { + tracker_name = "/user/hand/right"; + } + Tracker *tracker = find_tracker(tracker_name); ERR_FAIL_NULL(tracker); // TODO OpenXR does not support delay, so we may need to add support for that somehow... diff --git a/scene/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp index fe4ccbc7dc..f5d30c584f 100644 --- a/scene/3d/xr_nodes.cpp +++ b/scene/3d/xr_nodes.cpp @@ -363,7 +363,7 @@ void XRNode3D::_unbind_tracker() { } void XRNode3D::_changed_tracker(const StringName p_tracker_name, int p_tracker_type) { - if (p_tracker_name == p_tracker_name) { + if (tracker_name == p_tracker_name) { // just in case unref our current tracker _unbind_tracker(); @@ -373,7 +373,7 @@ void XRNode3D::_changed_tracker(const StringName p_tracker_name, int p_tracker_t } void XRNode3D::_removed_tracker(const StringName p_tracker_name, int p_tracker_type) { - if (p_tracker_name == p_tracker_name) { + if (tracker_name == p_tracker_name) { // unref our tracker, it's no longer available _unbind_tracker(); } |