Skip to content

francescomazzella/FirstPersonEditorControls-three.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

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

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.

The maximum movement speed, useful when sprint acceleration is enabled. Default is 2.0.

The movement acceleration when sprinting. Default is 0.15.

movementSpeed : Number

The movement speed. Default is 1.

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.

About

First person camera controls for three.js inspired by Unity's scene editor camera controls

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published