diff --git a/docs/examples/en/controls/PointerLockControls.html b/docs/examples/en/controls/PointerLockControls.html index 07206e2bb127cd..5b2698292b76f9 100644 --- a/docs/examples/en/controls/PointerLockControls.html +++ b/docs/examples/en/controls/PointerLockControls.html @@ -96,6 +96,11 @@

[property:Float minPolarAngle]

Camera pitch, lower limit. Range is 0 to Math.PI radians. Default is 0.

+

[property:Float pointerSpeed]

+

+ Multiplier for how much the pointer movement influences the camera rotation. Default is 1. +

+

Methods

See the base [page:EventDispatcher] class for common methods.

diff --git a/examples/js/controls/PointerLockControls.js b/examples/js/controls/PointerLockControls.js index c46fb38653c746..45bd8b46596d27 100644 --- a/examples/js/controls/PointerLockControls.js +++ b/examples/js/controls/PointerLockControls.js @@ -37,6 +37,8 @@ this.maxPolarAngle = Math.PI; // radians + this.pointerSpeed = 1.0; + const scope = this; function onMouseMove( event ) { @@ -47,8 +49,8 @@ _euler.setFromQuaternion( camera.quaternion ); - _euler.y -= movementX * 0.002; - _euler.x -= movementY * 0.002; + _euler.y -= movementX * 0.002 * scope.pointerSpeed; + _euler.x -= movementY * 0.002 * scope.pointerSpeed; _euler.x = Math.max( _PI_2 - scope.maxPolarAngle, Math.min( _PI_2 - scope.minPolarAngle, _euler.x ) ); camera.quaternion.setFromEuler( _euler ); scope.dispatchEvent( _changeEvent ); diff --git a/examples/jsm/controls/PointerLockControls.js b/examples/jsm/controls/PointerLockControls.js index f612610f9a8d31..884a69ced30726 100644 --- a/examples/jsm/controls/PointerLockControls.js +++ b/examples/jsm/controls/PointerLockControls.js @@ -34,6 +34,8 @@ class PointerLockControls extends EventDispatcher { this.minPolarAngle = 0; // radians this.maxPolarAngle = Math.PI; // radians + this.pointerSpeed = 1.0; + const scope = this; function onMouseMove( event ) { @@ -45,8 +47,8 @@ class PointerLockControls extends EventDispatcher { _euler.setFromQuaternion( camera.quaternion ); - _euler.y -= movementX * 0.002; - _euler.x -= movementY * 0.002; + _euler.y -= movementX * 0.002 * scope.pointerSpeed; + _euler.x -= movementY * 0.002 * scope.pointerSpeed; _euler.x = Math.max( _PI_2 - scope.maxPolarAngle, Math.min( _PI_2 - scope.minPolarAngle, _euler.x ) );