From d038beb4fed73a4fa8d4891f4454a7c09ec1a3fa Mon Sep 17 00:00:00 2001 From: Rupert Rawnsley Date: Wed, 16 Jun 2021 14:28:50 +0100 Subject: [PATCH] Fix forward and backward motion when using on-screen touch joysticks. --- src/components/virtual-gamepad-controls.js | 2 +- src/systems/character-controller-system.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/virtual-gamepad-controls.js b/src/components/virtual-gamepad-controls.js index 6953f491eb..e359ce0aa6 100644 --- a/src/components/virtual-gamepad-controls.js +++ b/src/components/virtual-gamepad-controls.js @@ -160,7 +160,7 @@ AFRAME.registerComponent("virtual-gamepad-controls", { if (window.APP.preferenceScreenIsVisible) return; const angle = joystick.angle.radian; const force = joystick.force < 1 ? joystick.force : 1; - this.displacement.set(Math.cos(angle), 0, Math.sin(angle)).multiplyScalar(force * 1.85); + this.displacement.set(Math.cos(angle), 0, -Math.sin(angle)).multiplyScalar(force * 1.85); this.moving = true; }, diff --git a/src/systems/character-controller-system.js b/src/systems/character-controller-system.js index 5f720e9f6a..e05ba877af 100644 --- a/src/systems/character-controller-system.js +++ b/src/systems/character-controller-system.js @@ -71,7 +71,6 @@ export class CharacterControllerSystem { this.waypoints.push({ transform: getPooledMatrix4().copy(inTransform), isInstant, waypointComponentData }); //TODO: don't create new object } enqueueRelativeMotion(motion) { - motion.z *= -1; this.relativeMotion.add(motion); } enqueueInPlaceRotationAroundWorldUp(dXZ) {