[name]

This class is an alternative implementation of [page:FlyControls].

Examples

[example:webgl_geometry_terrain webgl / geometry / terrain ]

Constructor

[name]( [param:Camera object], [param:HTMLDOMElement domElement] )

[page:Camera object]: The camera to be controlled.

[page:HTMLDOMElement domElement]: The HTML element used for event listeners.

Creates a new instance of [name].

Properties

[property:Boolean activeLook]

Whether or not it's possible to look around. Default is `true`.

[property:Boolean autoForward]

Whether or not the camera is automatically moved forward. Default is `false`.

[property:Boolean constrainVertical]

Whether or not looking around is vertically constrained by [[page:.verticalMin], [page:.verticalMax]]. Default is `false`.

[property:HTMLDOMElement domElement]

The HTMLDOMElement used to listen for mouse / touch events. This must be passed in the constructor; changing it here will not set up new event listeners.

[property:Boolean enabled]

Whether or not the controls are enabled. Default is `true`.

[property:Number heightCoef]

Determines how much faster the camera moves when it's y-component is near [page:.heightMax]. Default is *1*.

[property:Number heightMax]

Upper camera height limit used for movement speed adjustment. Default is *1*.

[property:Number heightMin]

Lower camera height limit used for movement speed adjustment. Default is *0*.

[property:Boolean heightSpeed]

Whether or not the camera's height influences the forward movement speed. Default is `false`. Use the properties [page:.heightCoef], [page:.heightMin] and [page:.heightMax] for configuration.

[property:Boolean lookVertical]

Whether or not it's possible to vertically look around. Default is `true`.

[property:Number lookSpeed]

The look around speed. Default is `0.005`.

[property:Boolean mouseDragOn]

Whether or not the mouse is pressed down. Read-only property.

[property:Number movementSpeed]

The movement speed. Default is *1*.

[property:Camera object]

The camera to be controlled.

[property:Number verticalMax]

How far you can vertically look around, upper limit. Range is 0 to Math.PI radians. Default is `Math.PI`.

[property:Number verticalMin]

How far you can vertically look around, lower limit. Range is 0 to Math.PI radians. Default is *0*.

Methods

[method:undefined dispose] ()

Should be called if the controls is no longer required.

[method:undefined handleResize] ()

Should be called if the application window is resized.

[method:FirstPersonControls lookAt]( [param:Vector3 vector] )
[method:FirstPersonControls lookAt]( [param:Float x], [param:Float y], [param:Float z] )

vector - A vector representing the target position.

Optionally, the x, y, z components of the world space position.

Ensures the controls orient the camera towards the defined target position.

[method:undefined update] ( [param:Number delta] )

[page:Number delta]: Time delta value.

Updates the controls. Usually called in the animation loop.

Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/FirstPersonControls.js examples/jsm/controls/FirstPersonControls.js]