Skip to content

Commit

Permalink
Player bounding box tweak and cursor error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
printer83mph committed Aug 2, 2023
1 parent 545c877 commit 9eeb99c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/constants/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ export const MOVEMENT = {

export const GRAVITY = new Vector3(0, -19.6, 0);

export const PLAYER_COLLISION_POINTS_Y = [0, 1.7 / 2, 1.7];
export const PLAYER_COLLISION_POINTS_X = [-0.3, 0.3];
export const PLAYER_COLLISION_POINTS_Y = [0, 1.8 / 2, 1.8];
export const PLAYER_COLLISION_POINTS_X = [-0.4, 0.4];
6 changes: 5 additions & 1 deletion src/lib/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ export default class InputListener {
this.element = element;

element.addEventListener('click', () => {
element.requestPointerLock();
try {
element.requestPointerLock();
} catch (_) {
/* empty */
}
});
document.addEventListener('pointerlockchange', () => {
if (document.pointerLockElement === element) {
Expand Down

0 comments on commit 9eeb99c

Please sign in to comment.