panlock
This commit is contained in:
parent
7c53af2380
commit
c900e81fb8
@ -193,8 +193,6 @@ export class Game {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.socket.on('me', (user) => {
|
this.socket.on('me', (user) => {
|
||||||
console.log(user);
|
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
this._loading.showError('Error: You need to log in!');
|
this._loading.showError('Error: You need to log in!');
|
||||||
window.location.href = '/login';
|
window.location.href = '/login';
|
||||||
|
@ -37,18 +37,15 @@ export class ThirdPersonCamera {
|
|||||||
this.mousePos = this.mousePos.fromArray([x, y]);
|
this.mousePos = this.mousePos.fromArray([x, y]);
|
||||||
const offset = this.prevMousePos.clone().sub(this.mousePos);
|
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) {
|
if (this.panning) {
|
||||||
|
if (this.locked && this._moveFn) {
|
||||||
|
this._moveFn(offset.x, offset.y);
|
||||||
|
} else {
|
||||||
this.angleAroundPlayer =
|
this.angleAroundPlayer =
|
||||||
this.angleAroundPlayer + ((offset.x * 0.3) % 360);
|
this.angleAroundPlayer + ((offset.x * 0.3) % 360);
|
||||||
this.pitch = clamp(this.pitch + offset.y * 0.3, -90, 90);
|
}
|
||||||
|
|
||||||
|
this.pitch = clamp(this.pitch + offset.y * 0.3, -90, 90);
|
||||||
this.calculateCameraOffset();
|
this.calculateCameraOffset();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user