From 039722a3418dfd8f16cd3e956527ef93e639ddba Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Sun, 25 Aug 2024 17:04:46 -0700 Subject: [PATCH] Fix invalid `Skeleton3D` bone pose updates The issue would cause log spams when trying to update the bone pose position or rotation with an invalid bone index. --- scene/3d/xr_hand_modifier_3d.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scene/3d/xr_hand_modifier_3d.cpp b/scene/3d/xr_hand_modifier_3d.cpp index baaa9eee48d..aa63fb623f1 100644 --- a/scene/3d/xr_hand_modifier_3d.cpp +++ b/scene/3d/xr_hand_modifier_3d.cpp @@ -207,6 +207,11 @@ void XRHandModifier3D::_process_modification() { // Apply previous relative transforms if they are stored. for (int joint = 0; joint < XRHandTracker::HAND_JOINT_MAX; joint++) { + const int bone = joints[joint].bone; + if (bone == -1) { + continue; + } + if (bone_update == BONE_UPDATE_FULL) { skeleton->set_bone_pose_position(joints[joint].bone, previous_relative_transforms[joint].origin); }