three-fpecontrols
v1.0.3
Published
First Person Controls for three.js inspired by Unity's scene editor controls
Downloads
19
Maintainers
Readme
FirstPersonEditorControls
This class is an alternative implementation of FirstPersonControls, inspired by Unity's scene editor camera controls.
Constructor
FirstPersonEditorControls( object : camera, domElement : HTMLElement )
object: The camera to be controlled.
domElement: The HTML element used for event listeners.
Creates a new instance of FirstPersonEditorControls.
Properties
.activeLook : Boolean
Whether or not it's possible to look around. Default is true.
.autoForward : Boolean
Whether or not the camera is automatically moved forward. Default is false.
.captureMouse : Boolean
Whether or not looking around locks the pointer. Default is true.
.constrainVertical : Boolean
Whether or not looking around is vertically constrained by [.verticalMin, .verticalMax]. Default is false.
.domElement : HTMLElement
The HTMLElement used to listen for mouse / touch events. This must be passed in the constructor; changing it here will not set up new event listeners.
enabled : Boolean
Whether or not the controls are enabled. Default is true.
heightCoef : Number
Determines how much faster the camera moves when it's y-component is near .heightMax. Default is 1.
heightMax : Number
Upper camera height limit used for movement speed adjustment. Default is 1.
heightMin : Number
Lower camera height limit used for movement speed adjustment. Default is 0.
heightSpeed : Boolean
Whether or not the camera's height influences the forward movement speed. Default is false. Use the properties .heightCoef, .heightMin and .heightMax for configuration.
lookVertical : Boolean
Whether or not it's possible to vertically look around. Default is true.
lookSpeed : Number
The look around speed. Default is 0.005.
maxMovementSpeed : Number
The maximum movement speed, useful when sprint acceleration is enabled. Default is 2.0.
movementAcceleration : Number
The movement acceleration when sprinting. Default is 0.15.
movementSpeed : Number
The movement speed. Default is 1.
object : Camera
The camera to be controlled.
verticalMax : Number
How far you can vertically look around, upper limit. Range is 0 to Math.PI radians. Default is Math.PI.
verticalMin : Number
How far you can vertically look around, lower limit. Range is 0 to Math.PI radians. Default is 0.
Methods
dispose () : null
Should be called if the controls is no longer required.
.lookAt ( vector : Vector3 ) : FirstPersonEditorControls
.lookAt ( x : Number, y : Number, z : Number ) : FirstPersonEditorControls
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.
.update ( delta : Number ) : null
delta: Time delta value.
Updates the controls. Usually called in the animation loop.