Parcourir la source

move to the right axes of the gamepad

Raanan Weber il y a 5 ans
Parent
commit
d840fe9a32
1 fichiers modifiés avec 7 ajouts et 7 suppressions
  1. 7 7
      src/Cameras/XR/webXRControllerTeleportation.ts

+ 7 - 7
src/Cameras/XR/webXRControllerTeleportation.ts

@@ -100,13 +100,13 @@ export class WebXRControllerTeleportation {
                 }
 
                 if (c.inputSource.gamepad) {
-                    if (c.inputSource.gamepad.axes[1] !== undefined) {
+                    if (c.inputSource.gamepad.axes[3] !== undefined) {
                         // Forward teleportation
-                        if (c.inputSource.gamepad.axes[1] < -0.7) {
+                        if (c.inputSource.gamepad.axes[3] < -0.7) {
                             forwardReadyToTeleport = true;
                         } else {
                             if (forwardReadyToTeleport) {
-                                // Teleport the users feet to where they targetted
+                                // Teleport the users feet to where they targeted
                                 this._tmpVector.copyFrom(teleportationTarget.position);
                                 this._tmpVector.y += input.baseExperience.camera.position.y;
                                 input.baseExperience.setPositionOfCameraUsingContainer(this._tmpVector);
@@ -115,7 +115,7 @@ export class WebXRControllerTeleportation {
                         }
 
                         // Backward teleportation
-                        if (c.inputSource.gamepad.axes[1] > 0.7) {
+                        if (c.inputSource.gamepad.axes[3] > 0.7) {
                             backwardReadyToTeleport = true;
                         } else {
                             if (backwardReadyToTeleport) {
@@ -145,8 +145,8 @@ export class WebXRControllerTeleportation {
                         }
                     }
 
-                    if (c.inputSource.gamepad.axes[0] !== undefined) {
-                        if (c.inputSource.gamepad.axes[0] < -0.7) {
+                    if (c.inputSource.gamepad.axes[2] !== undefined) {
+                        if (c.inputSource.gamepad.axes[2] < -0.7) {
                             leftReadyToTeleport = true;
                         } else {
                             if (leftReadyToTeleport) {
@@ -154,7 +154,7 @@ export class WebXRControllerTeleportation {
                             }
                             leftReadyToTeleport = false;
                         }
-                        if (c.inputSource.gamepad.axes[0] > 0.7) {
+                        if (c.inputSource.gamepad.axes[2] > 0.7) {
                             rightReadyToTeleport = true;
                         } else {
                             if (rightReadyToTeleport) {