Skip to content

Commit

Permalink
PointerLockControls: remove browser prefixes for "MouseEvent.movement" (
Browse files Browse the repository at this point in the history
  • Loading branch information
satelllte authored Nov 4, 2024
1 parent c3f685f commit 728ebc1
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions examples/jsm/controls/PointerLockControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,11 @@ function onMouseMove( event ) {

if ( this.enabled === false || this.isLocked === false ) return;

const movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0;
const movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0;

const camera = this.object;
_euler.setFromQuaternion( camera.quaternion );

_euler.y -= movementX * 0.002 * this.pointerSpeed;
_euler.x -= movementY * 0.002 * this.pointerSpeed;
_euler.y -= event.movementX * 0.002 * this.pointerSpeed;
_euler.x -= event.movementY * 0.002 * this.pointerSpeed;

_euler.x = Math.max( _PI_2 - this.maxPolarAngle, Math.min( _PI_2 - this.minPolarAngle, _euler.x ) );

Expand Down

0 comments on commit 728ebc1

Please sign in to comment.