Skip to content

Commit a33c5f6

Browse files
committed
Hand joints bug fixes
- Fixed: Hand joints don't get radius. - Fixed: Hand joints instantiate at wrong position.
1 parent 1e02b3e commit a33c5f6

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

Packages/webxr-interactions/Runtime/Scripts/ControllerInteraction.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,9 @@ private void OnHandUpdate(WebXRHandData handData)
279279
}
280280
else
281281
{
282-
var clone = Instantiate(handJointPrefab,
283-
rotationOffset * (handData.joints[i].position - handData.joints[0].position),
284-
rotationOffset * handData.joints[i].rotation,
285-
transform);
282+
var clone = Instantiate(handJointPrefab, transform);
283+
clone.localPosition = rotationOffset * (handData.joints[i].position - handData.joints[0].position);
284+
clone.localRotation = rotationOffset * handData.joints[i].rotation;
286285
if (handData.joints[i].radius > 0f)
287286
{
288287
clone.localScale = new Vector3(handData.joints[i].radius, handData.joints[i].radius, handData.joints[i].radius);

Packages/webxr/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Fixed
9+
- Hand joints don't get radius.
10+
- Hand joints instantiate at wrong position.
811

912
## [0.10.0] - 2021-05-06
1013
### Added

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

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ setTimeout(function () {
122122
this.radii = new Float32Array(25);
123123
this.jointQuaternion = new Float32Array(4);
124124
this.jointIndex = 0;
125-
this.handValues = null;
126125
this.handValuesType = 0;
126+
this.hasRadii = false;
127127
}
128128

129129
function XRJointData() {
@@ -620,28 +620,26 @@ setTimeout(function () {
620620
}
621621
xrHand.enabled = 1;
622622

623-
switch (xrHand.handValuesType) {
624-
case 0:
625-
if (inputSource.hand.values) {
626-
xrHand.handValues = inputSource.hand.values();
627-
xrHand.handValuesType = 1
628-
} else {
629-
xrHand.handValues = inputSource.hand;
630-
xrHand.handValuesType = 2
631-
}
632-
break;
633-
case 1:
634-
xrHand.handValues = inputSource.hand.values();
635-
break;
636-
case 2:
637-
xrHand.handValues = inputSource.hand;
638-
break;
623+
if (xrHand.handValuesType == 0) {
624+
if (inputSource.hand.values) {
625+
xrHand.handValuesType = 1
626+
} else {
627+
xrHand.handValuesType = 2
628+
}
639629
}
640-
if (!frame.fillPoses(xrHand.handValues, refSpace, xrHand.poses)) {
630+
if (!frame.fillPoses(
631+
xrHand.handValuesType == 1 ? inputSource.hand.values() : inputSource.hand,
632+
refSpace,
633+
xrHand.poses)) {
641634
xrHand.enabled = 0;
642635
continue;
643636
}
644-
frame.fillJointRadii(xrHand.handValues, xrHand.radii);
637+
if (!xrHand.hasRadii)
638+
{
639+
xrHand.hasRadii = frame.fillJointRadii(
640+
xrHand.handValuesType == 1 ? inputSource.hand.values() : inputSource.hand,
641+
xrHand.radii);
642+
}
645643
for (var j = 0; j < 25; j++) {
646644
xrHand.jointIndex = j*16;
647645
if (!isNaN(xrHand.poses[xrHand.jointIndex])) {

0 commit comments

Comments
 (0)