Skip to content

Commit

Permalink
prevent vertical camera panning
Browse files Browse the repository at this point in the history
  • Loading branch information
orion3dgames committed May 29, 2024
1 parent e53e0bd commit 7049a88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/client/Controllers/AssetsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,6 @@ export class AssetsController {
} else {
m.receiveShadows = false;
}

console.log(m.name);
});

// only render shadows once
Expand Down
9 changes: 4 additions & 5 deletions src/client/Entities/Player/PlayerCamera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ export class PlayerCamera {
}

public update(): void {

let preventVertical = false;
let preventVertical = true;

// rotate camera around the Y position if right click is true
if (!this._input.middle_click) {
Expand All @@ -67,16 +66,16 @@ export class PlayerCamera {

// only do vertical if allowed
let rotationX = 0;
if(!preventVertical){
rotationX = Math.abs(this._camRoot.rotation.x + this._input.movementY) < 0.5 ? this._camRoot.rotation.x + this._input.movementY : this._camRoot.rotation.x;
if (!preventVertical) {
rotationX =
Math.abs(this._camRoot.rotation.x + this._input.movementY) < 0.5 ? this._camRoot.rotation.x + this._input.movementY : this._camRoot.rotation.x;
}

// set horizontal rotation
const rotationY = this._camRoot.rotation.y + this._input.movementX;

// apply canmera rotation
this._camRoot.rotation = new Vector3(rotationX, rotationY, 0);

}

public zoom(deltaY): void {
Expand Down

0 comments on commit 7049a88

Please sign in to comment.