Skip to content

Commit bd3cd36

Browse files
authored
Merge pull request #113 from De-Panther/new_xrhand_api_support
Support the new/updated WebXR Hands API
2 parents 8abe6e6 + 8ee6ed0 commit bd3cd36

File tree

6 files changed

+36
-10
lines changed

6 files changed

+36
-10
lines changed

Build/webxr.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,13 @@
594594
xrHand.hand = 2;
595595
}
596596
xrHand.enabled = 1;
597-
frame.fillPoses(inputSource.hand, refSpace, xrHand.poses);
598-
frame.fillJointRadii(inputSource.hand, xrHand.radii);
597+
if (inputSource.hand.values) {
598+
frame.fillPoses(inputSource.hand.values(), refSpace, xrHand.poses);
599+
frame.fillJointRadii(inputSource.hand.values(), xrHand.radii);
600+
} else {
601+
frame.fillPoses(inputSource.hand, refSpace, xrHand.poses);
602+
frame.fillJointRadii(inputSource.hand, xrHand.radii);
603+
}
599604
for (let j = 0; j < 25; j++) {
600605
xrHand.jointIndex = j*16;
601606
if (!isNaN(xrHand.poses[xrHand.jointIndex])) {

Packages/webxr/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88
### Added
99
- GetLocalRotation and GetLocalPosition to WebXRCamera.
10+
- Support for the new/updated WebXR Hands API.
1011

1112
### Changed
1213
- Using `frame.fillPoses` and `frame.fillJointRadii` instead of `frame.getJointPose` for XRHand.

Packages/webxr/Hidden~/WebGLTemplates/WebXR/webxr.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,13 @@
594594
xrHand.hand = 2;
595595
}
596596
xrHand.enabled = 1;
597-
frame.fillPoses(inputSource.hand, refSpace, xrHand.poses);
598-
frame.fillJointRadii(inputSource.hand, xrHand.radii);
597+
if (inputSource.hand.values) {
598+
frame.fillPoses(inputSource.hand.values(), refSpace, xrHand.poses);
599+
frame.fillJointRadii(inputSource.hand.values(), xrHand.radii);
600+
} else {
601+
frame.fillPoses(inputSource.hand, refSpace, xrHand.poses);
602+
frame.fillJointRadii(inputSource.hand, xrHand.radii);
603+
}
599604
for (let j = 0; j < 25; j++) {
600605
xrHand.jointIndex = j*16;
601606
if (!isNaN(xrHand.poses[xrHand.jointIndex])) {

Packages/webxr/Hidden~/WebGLTemplates/WebXR2020/webxr.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,13 @@
594594
xrHand.hand = 2;
595595
}
596596
xrHand.enabled = 1;
597-
frame.fillPoses(inputSource.hand, refSpace, xrHand.poses);
598-
frame.fillJointRadii(inputSource.hand, xrHand.radii);
597+
if (inputSource.hand.values) {
598+
frame.fillPoses(inputSource.hand.values(), refSpace, xrHand.poses);
599+
frame.fillJointRadii(inputSource.hand.values(), xrHand.radii);
600+
} else {
601+
frame.fillPoses(inputSource.hand, refSpace, xrHand.poses);
602+
frame.fillJointRadii(inputSource.hand, xrHand.radii);
603+
}
599604
for (let j = 0; j < 25; j++) {
600605
xrHand.jointIndex = j*16;
601606
if (!isNaN(xrHand.poses[xrHand.jointIndex])) {

Packages/webxr/Hidden~/WebGLTemplates/WebXRFullView/webxr.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,13 @@
594594
xrHand.hand = 2;
595595
}
596596
xrHand.enabled = 1;
597-
frame.fillPoses(inputSource.hand, refSpace, xrHand.poses);
598-
frame.fillJointRadii(inputSource.hand, xrHand.radii);
597+
if (inputSource.hand.values) {
598+
frame.fillPoses(inputSource.hand.values(), refSpace, xrHand.poses);
599+
frame.fillJointRadii(inputSource.hand.values(), xrHand.radii);
600+
} else {
601+
frame.fillPoses(inputSource.hand, refSpace, xrHand.poses);
602+
frame.fillJointRadii(inputSource.hand, xrHand.radii);
603+
}
599604
for (let j = 0; j < 25; j++) {
600605
xrHand.jointIndex = j*16;
601606
if (!isNaN(xrHand.poses[xrHand.jointIndex])) {

Packages/webxr/Hidden~/WebGLTemplates/WebXRFullView2020/webxr.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,13 @@
594594
xrHand.hand = 2;
595595
}
596596
xrHand.enabled = 1;
597-
frame.fillPoses(inputSource.hand, refSpace, xrHand.poses);
598-
frame.fillJointRadii(inputSource.hand, xrHand.radii);
597+
if (inputSource.hand.values) {
598+
frame.fillPoses(inputSource.hand.values(), refSpace, xrHand.poses);
599+
frame.fillJointRadii(inputSource.hand.values(), xrHand.radii);
600+
} else {
601+
frame.fillPoses(inputSource.hand, refSpace, xrHand.poses);
602+
frame.fillJointRadii(inputSource.hand, xrHand.radii);
603+
}
599604
for (let j = 0; j < 25; j++) {
600605
xrHand.jointIndex = j*16;
601606
if (!isNaN(xrHand.poses[xrHand.jointIndex])) {

0 commit comments

Comments
 (0)