ControlSettings

Class for storing and applying camera control settings.

Code Example

const aspect = app.container.offsetWidth / app.container.offsetHeight; const camera = new v3d.PerspectiveCamera(45, aspect, 1, 1000); camera.position.z = -5; camera.controlSettings = new v3d.ControlSettings('ORBIT'); app.scene.add(camera); // sets active camera and assigns app controls app.setCamera(camera);

Constructor

ControlSettings(type : String, enablePan : Boolean, rotateSpeed : Float, moveSpeed : Float)

Create a new object with camera control settings.

Properties

.enableKeys : Boolean

Enable or disable the use of keyboard controls. Default is true.

.enablePan : Boolean

Enable or disable camera panning. Default is true.

.enableRotate : Boolean

Enable or disable horizontal and vertical rotation of the camera. Default is true.

.enableZoom : Boolean

Enable or disable zooming (dollying) of the camera.

.moveSpeed : Float

Movements speed factor. Upon assigning settings to actual controls object, this value affects both panning and zooming speeds. Default is 1.

.orbitEnableTurnover : Boolean

Enable or disable moving the camera over the head. Default is false.

.orbitMaxAzimuthAngle : Float

How far you can orbit horizontally, upper limit. Range is -Math.PI to Math.PI (or Infinity for no limit) and default is Infinity;

.orbitMaxDistance : Float

How far you can dolly out (PerspectiveCamera only). Default is Infinity.

.orbitMaxPolarAngle : Float

How far you can orbit vertically, upper limit. Range is 0 to Math.PI radians, and default is Math.PI.

.orbitMaxZoom : Float

How far you can zoom out (OrthographicCamera only). Default is Infinity.

.orbitMinAzimuthAngle : Float

How far you can orbit horizontally, lower limit. Range is -Math.PI to Math.PI (or -Infinity for no limit) and default is -Infinity;

.orbitMinDistance : Float

How far you can dolly in (PerspectiveCamera only). Default is 0.

.orbitMinPolarAngle : Float

How far you can orbit vertically, lower limit. Range is 0 to Math.PI radians, and default is 0.

.orbitMinZoom : Float

How far you can zoom in (OrthographicCamera only). Default is 0.

.rotateSpeed : Float

Rotations speed factor. Default is 1.

.type : String

Controls type: 'ORBIT', 'FIRST_PERSON', or 'FLYING'.

Methods

.assignToControls(controls : Controls, scene : Scene)

Assign control settings to actual controls object.

.clone() → ControlSettings

Clone control settings.

.copy(source : ControlSettings) → ControlSettings

Copy control settings.

Source

For more info on how to obtain the source code of this module see this page.