From 22209db1c9a52cbedcbde86ec5f7d01af874d0b7 Mon Sep 17 00:00:00 2001 From: Malcolm Nixon Date: Fri, 19 Jul 2024 08:45:46 -0400 Subject: [PATCH] Add checking of hand-tracking state. --- addons/hand_pose_detector/hand_pose_detector.gd | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/hand_pose_detector/hand_pose_detector.gd b/addons/hand_pose_detector/hand_pose_detector.gd index 357bcb2..f3a10a0 100644 --- a/addons/hand_pose_detector/hand_pose_detector.gd +++ b/addons/hand_pose_detector/hand_pose_detector.gd @@ -65,6 +65,14 @@ func _process(delta: float) -> void: if not tracker or not hand_pose_set: return + # If the palm is not tracked then skip pose detection. Any current pose will + # remain active until we see the hand again. + var flags := tracker.get_hand_joint_flags(XRHandTracker.HAND_JOINT_PALM) + if (flags & XRHandTracker.HAND_JOINT_FLAG_POSITION_TRACKED) == 0: + return; + if (flags & XRHandTracker.HAND_JOINT_FLAG_ORIENTATION_TRACKED) == 0: + return; + # Save the active pose before updates (to report changes) var active_pos := _current_pose