Skip to content

Commit 0d432f9

Browse files
committed
The right solution
1 parent 5293eb8 commit 0d432f9

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

Packages/webxr/Runtime/Plugins/WebGL/webxr.jspre

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -619,13 +619,18 @@ setTimeout(function () {
619619
}
620620
xrHand.enabled = 1;
621621
if (inputSource.hand.values) {
622-
frame.fillPoses(inputSource.hand.values(), refSpace, xrHand.poses);
622+
if (!frame.fillPoses(inputSource.hand.values(), refSpace, xrHand.poses)) {
623+
xrHand.enabled = 0;
624+
continue;
625+
}
623626
frame.fillJointRadii(inputSource.hand.values(), xrHand.radii);
624627
} else {
625-
frame.fillPoses(inputSource.hand, refSpace, xrHand.poses);
628+
if (!frame.fillPoses(inputSource.hand, refSpace, xrHand.poses)) {
629+
xrHand.enabled = 0;
630+
continue;
631+
}
626632
frame.fillJointRadii(inputSource.hand, xrHand.radii);
627633
}
628-
var jointsCount = 0;
629634
for (var j = 0; j < 25; j++) {
630635
xrHand.jointIndex = j*16;
631636
if (!isNaN(xrHand.poses[xrHand.jointIndex])) {
@@ -641,19 +646,6 @@ setTimeout(function () {
641646
if (!isNaN(xrHand.radii[j])) {
642647
xrHand.joints[j].radius = xrHand.radii[j];
643648
}
644-
// Ugly hack(?) to disable hand when not tracking
645-
if (jointsCount == 0
646-
&& xrHand.joints[j].position[0] == 0
647-
&& xrHand.joints[j].position[1] == 0
648-
&& xrHand.joints[j].position[2] == 0
649-
&& xrHand.joints[j].rotation[0] == 0
650-
&& xrHand.joints[j].rotation[1] == 0
651-
&& xrHand.joints[j].rotation[2] == 0
652-
&& xrHand.joints[j].rotation[3] == 0.5) {
653-
xrHand.enabled = 0;
654-
break;
655-
}
656-
jointsCount++;
657649
}
658650
}
659651
} else if (inputSource.gripSpace) {

0 commit comments

Comments
 (0)