From c900e81fb81d2c143497ab203727aa96f1b0f4fb Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Sat, 16 Apr 2022 16:31:13 +0300 Subject: [PATCH] panlock --- src/client/game.ts | 2 -- src/client/object/camera.ts | 17 +++++++---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/client/game.ts b/src/client/game.ts index a3742a7..c86e952 100644 --- a/src/client/game.ts +++ b/src/client/game.ts @@ -193,8 +193,6 @@ export class Game { }); this.socket.on('me', (user) => { - console.log(user); - if (!user) { this._loading.showError('Error: You need to log in!'); window.location.href = '/login'; diff --git a/src/client/object/camera.ts b/src/client/object/camera.ts index 0b7a749..e05ce60 100644 --- a/src/client/object/camera.ts +++ b/src/client/object/camera.ts @@ -37,18 +37,15 @@ export class ThirdPersonCamera { this.mousePos = this.mousePos.fromArray([x, y]); const offset = this.prevMousePos.clone().sub(this.mousePos); - if (this.locked) { - if (this._moveFn && this.panning) { - this._moveFn(offset.x, offset.y); - } - return; - } - if (this.panning) { - this.angleAroundPlayer = - this.angleAroundPlayer + ((offset.x * 0.3) % 360); - this.pitch = clamp(this.pitch + offset.y * 0.3, -90, 90); + if (this.locked && this._moveFn) { + this._moveFn(offset.x, offset.y); + } else { + this.angleAroundPlayer = + this.angleAroundPlayer + ((offset.x * 0.3) % 360); + } + this.pitch = clamp(this.pitch + offset.y * 0.3, -90, 90); this.calculateCameraOffset(); } };