Skip to content

Commit 715bff6

Browse files
committed
Bug fixes
1 parent bf2d094 commit 715bff6

File tree

4 files changed

+15
-20
lines changed

4 files changed

+15
-20
lines changed

Packages/webxr-interactions/Samples~/Desert/Prefabs/WebXRCameraSet.prefab

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -288,14 +288,14 @@ Transform:
288288
m_PrefabInstance: {fileID: 0}
289289
m_PrefabAsset: {fileID: 0}
290290
m_GameObject: {fileID: 1136128897566686}
291-
m_LocalRotation: {x: 0.52522314, y: -0.47343507, z: -0.47343513, w: 0.52522284}
291+
m_LocalRotation: {x: 0.6298602, y: -0.32136607, z: -0.5932414, w: 0.3847918}
292292
m_LocalPosition: {x: -0, y: 0, z: 0}
293293
m_LocalScale: {x: 1, y: 1, z: 1}
294294
m_Children:
295295
- {fileID: 4099324660282070}
296296
m_Father: {fileID: 4427160273819458}
297297
m_RootOrder: 0
298-
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
298+
m_LocalEulerAnglesHint: {x: 5.9370003, y: -90.00001, z: -120}
299299
--- !u!1 &1156281662418980
300300
GameObject:
301301
m_ObjectHideFlags: 0
@@ -1044,14 +1044,14 @@ Transform:
10441044
m_PrefabInstance: {fileID: 0}
10451045
m_PrefabAsset: {fileID: 0}
10461046
m_GameObject: {fileID: 1644997114004198}
1047-
m_LocalRotation: {x: 0.5000001, y: 0.49999994, z: 0.49999994, w: 0.5000001}
1047+
m_LocalRotation: {x: 0.6123725, y: 0.35355338, z: 0.61237246, w: 0.35355335}
10481048
m_LocalPosition: {x: -0, y: 0, z: 0}
10491049
m_LocalScale: {x: 1, y: 1, z: 1}
10501050
m_Children:
10511051
- {fileID: 4761071769301884}
10521052
m_Father: {fileID: 4446684710817404}
10531053
m_RootOrder: 0
1054-
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
1054+
m_LocalEulerAnglesHint: {x: 0, y: 90.00001, z: 120}
10551055
--- !u!1 &1647411076831720
10561056
GameObject:
10571057
m_ObjectHideFlags: 0
@@ -1388,9 +1388,7 @@ MonoBehaviour:
13881388
m_Name:
13891389
m_EditorClassIdentifier:
13901390
hand: 1
1391-
simulate3dof: 0
1392-
eyesToElbow: {x: 0.1, y: -0.4, z: 0.15}
1393-
elbowHand: {x: 0, y: 0, z: 0.25}
1391+
alwaysUseGrip: 0
13941392
--- !u!114 &114589835210473740
13951393
MonoBehaviour:
13961394
m_ObjectHideFlags: 0
@@ -1870,9 +1868,7 @@ MonoBehaviour:
18701868
m_Name:
18711869
m_EditorClassIdentifier:
18721870
hand: 2
1873-
simulate3dof: 0
1874-
eyesToElbow: {x: 0.1, y: -0.4, z: 0.15}
1875-
elbowHand: {x: 0, y: 0, z: 0.25}
1871+
alwaysUseGrip: 0
18761872
--- !u!114 &114372649503696970
18771873
MonoBehaviour:
18781874
m_ObjectHideFlags: 0

Packages/webxr/Runtime/Plugins/WebGL/webxr.jslib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ mergeInto(LibraryManager.library, {
8282
Module.ControllersArray[index++] = data[key].touchpadY;
8383
Module.ControllersArray[index++] = data[key].buttonA;
8484
Module.ControllersArray[index++] = data[key].buttonB;
85-
Module.ControllersArray[index++] = data[key].updateGrip;
86-
if (data[key].updateGrip == 1) {
85+
Module.ControllersArray[index++] = data[key].updatedGrip;
86+
if (data[key].updatedGrip == 1) {
8787
Module.ControllersArray[index++] = data[key].gripPositionX;
8888
Module.ControllersArray[index++] = data[key].gripPositionY;
8989
Module.ControllersArray[index++] = data[key].gripPositionZ;

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,8 @@ setTimeout(function () {
692692

693693
controller.updatedGrip = 1;
694694
}
695+
} else if (controller.updatedGrip == 1) {
696+
controller.updatedGrip = 2;
695697
}
696698

697699
// if there's gamepad, use the xr-standard mapping
@@ -803,6 +805,8 @@ setTimeout(function () {
803805
this.xrData.controllerB.updatedProfiles = 0;
804806
this.xrData.controllerA.profiles = [];
805807
this.xrData.controllerB.profiles = [];
808+
this.xrData.controllerA.updatedGrip = 0;
809+
this.xrData.controllerB.updatedGrip = 0;
806810
}
807811
var thisXRMananger = this;
808812
session.requestReferenceSpace(refSpaceType).then(function (refSpace) {
@@ -925,12 +929,6 @@ setTimeout(function () {
925929
controllerA: xrData.controllerA,
926930
controllerB: xrData.controllerB
927931
}}));
928-
if (xrData.controllerA.updatedGrip == 1) {
929-
xrData.controllerA.updatedGrip = 2;
930-
}
931-
if (xrData.controllerB.updatedGrip == 1) {
932-
xrData.controllerB.updatedGrip = 2;
933-
}
934932

935933
document.dispatchEvent(new CustomEvent('XRHandsData', { detail: {
936934
handLeft: xrData.handLeft,

Packages/webxr/Runtime/XRPlugin/WebXRSubsystem.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ bool GetGamepadFromControllersArray(int controllerIndex, ref WebXRControllerData
384384
}
385385

386386
newControllerData.frame = frameNumber;
387+
bool wasDisabled = !newControllerData.enabled;
387388
newControllerData.enabled = controllersArray[arrayPosition++] != 0;
388389
newControllerData.hand = (int)controllersArray[arrayPosition++];
389390
if (!newControllerData.enabled)
@@ -404,14 +405,14 @@ bool GetGamepadFromControllersArray(int controllerIndex, ref WebXRControllerData
404405
newControllerData.touchpadY = controllersArray[arrayPosition++];
405406
newControllerData.buttonA = controllersArray[arrayPosition++];
406407
newControllerData.buttonB = controllersArray[arrayPosition++];
407-
if (controllersArray[arrayPosition++] == 1)
408+
if (controllersArray[arrayPosition++] == 1 || wasDisabled)
408409
{
409410
newControllerData.gripPosition = new Vector3(controllersArray[arrayPosition++], controllersArray[arrayPosition++], controllersArray[arrayPosition++]);
410411
newControllerData.gripRotation = new Quaternion(controllersArray[arrayPosition++], controllersArray[arrayPosition++], controllersArray[arrayPosition++],
411412
controllersArray[arrayPosition++]);
412413
Quaternion rotationOffset = Quaternion.Inverse(newControllerData.rotation);
413-
newControllerData.gripRotation = rotationOffset * newControllerData.gripRotation;
414414
newControllerData.gripPosition = rotationOffset * (newControllerData.gripPosition - newControllerData.position);
415+
newControllerData.gripRotation = rotationOffset * newControllerData.gripRotation;
415416
}
416417
return true;
417418
}

0 commit comments

Comments
 (0)