Skip to content

Commit c105fad

Browse files
committed
Build
1 parent 6372a65 commit c105fad

File tree

4 files changed

+50
-1
lines changed

4 files changed

+50
-1
lines changed

Build/Build/Build.data.unityweb

3.36 MB
Binary file not shown.

Build/Build/Build.wasm

7.87 MB
Binary file not shown.

Build/Build/Build.wasm.framework.unityweb

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

Build/webxr.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
this.buttonA = 0;
4242
this.buttonB = 0;
4343
this.gamepad = null;
44+
this.profiles = [];
45+
this.updatedProfiles = 0;
4446
}
4547

4648
function XRHandData() {
@@ -257,6 +259,26 @@
257259
this.viewerHitTestSource.cancel();
258260
this.viewerHitTestSource = null;
259261
}
262+
263+
this.xrData.controllerA.enabled = 0;
264+
this.xrData.controllerB.enabled = 0;
265+
this.xrData.handLeft.enabled = 0;
266+
this.xrData.handRight.enabled = 0;
267+
268+
this.xrData.controllerA.frame = -1;
269+
this.xrData.controllerB.frame = -1;
270+
this.xrData.handLeft.frame = -1;
271+
this.xrData.handRight.frame = -1;
272+
273+
document.dispatchEvent(new CustomEvent('XRControllersData', { detail: {
274+
controllerA: this.xrData.controllerA,
275+
controllerB: this.xrData.controllerB
276+
}}));
277+
278+
document.dispatchEvent(new CustomEvent('XRHandsData', { detail: {
279+
handLeft: this.xrData.handLeft,
280+
handRight: this.xrData.handRight
281+
}}));
260282

261283
this.gameModule.WebXR.OnEndXR();
262284
this.didNotifyUnity = false;
@@ -534,6 +556,12 @@
534556

535557
controller.enabled = 1;
536558
controller.hand = hand;
559+
560+
if (controller.updatedProfiles == 0)
561+
{
562+
controller.profiles = inputSource.profiles;
563+
controller.updatedProfiles = 1;
564+
}
537565

538566
controller.positionX = position.x;
539567
controller.positionY = position.y;
@@ -677,6 +705,11 @@
677705
session.addEventListener('squeeze', this.onInputEvent);
678706
session.addEventListener('squeezestart', this.onInputEvent);
679707
session.addEventListener('squeezeend', this.onInputEvent);
708+
709+
this.xrData.controllerA.updatedProfiles = 0;
710+
this.xrData.controllerB.updatedProfiles = 0;
711+
this.xrData.controllerA.profiles = [];
712+
this.xrData.controllerB.profiles = [];
680713
}
681714

682715
session.requestReferenceSpace(refSpaceType).then((refSpace) => {
@@ -754,6 +787,22 @@
754787
viewerHitTestPose: xrData.viewerHitTestPose
755788
}}));
756789
}
790+
791+
if (xrData.controllerA.updatedProfiles == 1 || xrData.controllerB.updatedProfiles == 1)
792+
{
793+
let inputProfiles = {};
794+
inputProfiles.conrtoller1 = xrData.controllerA.profiles;
795+
inputProfiles.conrtoller2 = xrData.controllerB.profiles;
796+
if (xrData.controllerA.updatedProfiles == 1)
797+
{
798+
xrData.controllerA.updatedProfiles = 2;
799+
}
800+
if (xrData.controllerB.updatedProfiles == 1)
801+
{
802+
xrData.controllerB.updatedProfiles = 2;
803+
}
804+
this.gameModule.WebXR.OnInputProfiles(JSON.stringify(inputProfiles));
805+
}
757806

758807
// Dispatch event with headset data to be handled in webxr.jslib
759808
document.dispatchEvent(new CustomEvent('XRData', { detail: {

0 commit comments

Comments
 (0)