Skip to content

Commit b1b9ab2

Browse files
authored
Merge pull request #85 from De-Panther/general_interactions_improvement
General interactions improvement
2 parents dea9ddd + 0ee63d9 commit b1b9ab2

15 files changed

+89
-144
lines changed

Build/Build/Build.data.unityweb

1.75 KB
Binary file not shown.

Build/Build/Build.wasm

27.3 KB
Binary file not shown.

Build/Build/Build.wasm.framework.unityweb

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

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,24 @@ void Update()
2727
{
2828
controller.TryUpdateButtons();
2929

30-
float normalizedTime = controller.GetButton("Trigger") ? 1 : controller.GetAxis("Grip");
31-
32-
if (controller.GetButtonDown("Trigger") || controller.GetButtonDown("Grip"))
30+
// Get button A(0 or 1), or Axis Trigger/Grip (0 to 1), the larger between them all, by that order
31+
float normalizedTime = controller.GetButton(WebXRController.ButtonTypes.ButtonA) ? 1 :
32+
Mathf.Max(controller.GetAxis(WebXRController.AxisTypes.Trigger),
33+
controller.GetAxis(WebXRController.AxisTypes.Grip));
34+
35+
if (controller.GetButtonDown(WebXRController.ButtonTypes.Trigger)
36+
|| controller.GetButtonDown(WebXRController.ButtonTypes.Grip)
37+
|| controller.GetButtonDown(WebXRController.ButtonTypes.ButtonA))
38+
{
3339
Pickup();
40+
}
3441

35-
if (controller.GetButtonUp("Trigger") || controller.GetButtonUp("Grip"))
42+
if (controller.GetButtonUp(WebXRController.ButtonTypes.Trigger)
43+
|| controller.GetButtonUp(WebXRController.ButtonTypes.Grip)
44+
|| controller.GetButtonUp(WebXRController.ButtonTypes.ButtonA))
45+
{
3646
Drop();
47+
}
3748

3849
// Use the controller button or axis position to manipulate the playback time for hand model.
3950
anim.Play("Take", -1, normalizedTime);

Packages/webxr-interactions/Samples~/Desert/ControllersMap.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

Packages/webxr-interactions/Samples~/Desert/ControllersMap/LeftControllerMap.asset

Lines changed: 0 additions & 19 deletions
This file was deleted.

Packages/webxr-interactions/Samples~/Desert/ControllersMap/LeftControllerMap.asset.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

Packages/webxr-interactions/Samples~/Desert/ControllersMap/RightControllerMap.asset

Lines changed: 0 additions & 19 deletions
This file was deleted.

Packages/webxr-interactions/Samples~/Desert/ControllersMap/RightControllerMap.asset.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,6 @@ MonoBehaviour:
13731373
m_Name:
13741374
m_EditorClassIdentifier:
13751375
hand: 1
1376-
inputMap: {fileID: 11400000, guid: f2b0e62590098b246823680b10d75b46, type: 2}
13771376
simulate3dof: 0
13781377
eyesToElbow: {x: 0.1, y: -0.4, z: 0.15}
13791378
elbowHand: {x: 0, y: 0, z: 0.25}
@@ -1864,7 +1863,6 @@ MonoBehaviour:
18641863
m_Name:
18651864
m_EditorClassIdentifier:
18661865
hand: 2
1867-
inputMap: {fileID: 11400000, guid: a37529c06e00da94091bc81a0193c815, type: 2}
18681866
simulate3dof: 0
18691867
eyesToElbow: {x: 0.1, y: -0.4, z: 0.15}
18701868
elbowHand: {x: 0, y: 0, z: 0.25}

0 commit comments

Comments
 (0)