summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFredia Huya-Kouadio <fhuyakou@gmail.com>2024-08-25 17:04:46 -0700
committerRémi Verschelde <rverschelde@gmail.com>2024-09-16 17:19:17 +0200
commit0f33a4b97ede3821495b24df70375cb61a779cb4 (patch)
tree01472f964d047227ebcf512751fbc419dd9bda40
parentf9bcd4f0caaf24b1b2e260f4514ab0c7e2b10e2c (diff)
downloadredot-engine-0f33a4b97ede3821495b24df70375cb61a779cb4.tar.gz
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. (cherry picked from commit 039722a3418dfd8f16cd3e956527ef93e639ddba)
-rw-r--r--scene/3d/xr_hand_modifier_3d.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/scene/3d/xr_hand_modifier_3d.cpp b/scene/3d/xr_hand_modifier_3d.cpp
index baaa9eee48..aa63fb623f 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);
}