This commit is contained in:
Evert Prants 2022-04-16 16:31:13 +03:00
parent 7c53af2380
commit c900e81fb8
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 7 additions and 12 deletions

View File

@ -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';

View File

@ -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();
}
};