FirstPersonControls Class

Extends Object3D
Module: Controls

First person controls can be controlled using the mouse and keyboard.

Provides a navigations system familiar to the one found on FPS games.

The mouse left button can be used to look around, and the keyboard arrows for movement.

Constructor

FirstPersonControls

()

Methods

getDirection

() Vector3

Used to get camera direction for this controller.

Controller direction can be used to simplify controlling physics objects, create objects in the camera direction, etc.

Returns:

Vector3:

Normalized camera direction.

Properties

moveKeys

Array

Array with keys to be used to move the object.

  • Forward
  • Backward
  • Left
  • Right

movementEnabled

Boolean

Indicates if its possible to move the object using the Keyboard keys.

Default: true

moveOnPlane

Boolean

If set to true the object will only move on X and Z axis.

Default: false

moveSpeed

Number

Movement speed, relative to the world.

Default: moveSpeed

needsButtonPressed

Boolean

Flag to indicate if the button left button needs to be pressed to rotate the object.

Default: true

sensitivity

Number

Mouse sensitivity.

Default: 0.001