Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FlyCamera

This is a flying camera, designed for 3D movement and rotation in all directions, such as in a 3D Space Shooter or a Flight Simulator.

Hierarchy

Index

Constructors

constructor

  • new FlyCamera(name: string, position: Vector3, scene?: Scene, setActiveOnSceneIfNoneActive?: boolean): FlyCamera
  • Instantiates a FlyCamera. This is a flying camera, designed for 3D movement and rotation in all directions, such as in a 3D Space Shooter or a Flight Simulator.

    Parameters

    • name: string

      Define the name of the camera in the scene.

    • position: Vector3

      Define the starting position of the camera in the scene.

    • Optional scene: Scene

      Define the scene the camera belongs to.

    • Optional setActiveOnSceneIfNoneActive: boolean

      Defines whether the camera should be marked as active, if no other camera has been defined as active.

    Returns FlyCamera

Properties

_trackRollSearch playground for _trackRoll

_trackRoll: number

Track Roll to maintain the wanted Rolling when looking around.

applyGravitySearch playground for applyGravity

applyGravity: boolean

Enable or disable gravity on the camera.

bankedTurnSearch playground for bankedTurn

bankedTurn: boolean

Mimic a banked turn, Rolling the camera when Yawing. It's recommended to use rollCorrect = 10 for faster banking correction.

bankedTurnLimitSearch playground for bankedTurnLimit

bankedTurnLimit: number

Limit in radians for how much Roll banking will add. (Default: 90°)

bankedTurnMultiplierSearch playground for bankedTurnMultiplier

bankedTurnMultiplier: number

Value of 0 disables the banked Roll. Value of 1 is equal to the Yaw angle in radians.

cameraDirectionSearch playground for cameraDirection

cameraDirection: Vector3

Define the current direction the camera is moving to.

cameraRotationSearch playground for cameraRotation

cameraRotation: Vector2

Define the current rotation the camera is rotating to

checkCollisionsSearch playground for checkCollisions

checkCollisions: boolean

Enable or disable collisions of the camera with the rest of the scene objects.

ellipsoidSearch playground for ellipsoid

ellipsoid: Vector3

Define the collision ellipsoid of the camera. This is helpful for simulating a camera body, like a player's body.

see

https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#arcrotatecamera

ellipsoidOffsetSearch playground for ellipsoidOffset

ellipsoidOffset: Vector3

Define an offset for the position of the ellipsoid around the camera. This can be helpful if the camera is attached away from the player's body center, such as at its head.

ignoreParentScalingSearch playground for ignoreParentScaling

ignoreParentScaling: boolean

Gets or sets a boolean indicating that the scaling of the parent hierarchy will not be taken in account by the camera

inputsSearch playground for inputs

The inputs manager loads all the input sources, such as keyboard and mouse.

inverseRotationSpeedSearch playground for inverseRotationSpeed

inverseRotationSpeed: number

Speed multiplier for inverse camera panning

invertRotationSearch playground for invertRotation

invertRotation: boolean

Reverses mouselook direction to 'natural' panning as opposed to traditional direct panning

lockedTargetSearch playground for lockedTarget

lockedTarget: any

Define the current target of the camera as an object or a position.

noRotationConstraintSearch playground for noRotationConstraint

noRotationConstraint: boolean

Add constraint to the camera to prevent it to move freely in all directions and around all axis.

onCollideSearch playground for onCollide

onCollide: (collidedMesh: AbstractMesh) => void

Event raised when the camera collides with a mesh in the scene.

Type declaration

rollCorrectSearch playground for rollCorrect

rollCorrect: number

Slowly correct the Roll to its original value after a Pitch+Yaw rotation.

rotationSearch playground for rotation

rotation: Vector3

Define the current rotation of the camera

rotationQuaternionSearch playground for rotationQuaternion

rotationQuaternion: Quaternion

Define the current local rotation of the camera as a quaternion to prevent Gimbal lock. This overrides and empties cameraRotation.

speedSearch playground for speed

speed: number

Define the current speed of the camera

updateUpVectorFromRotationSearch playground for updateUpVectorFromRotation

updateUpVectorFromRotation: boolean

When set, the up vector of the camera will be updated by the rotation of the camera

Accessors

angularSensibility

  • get angularSensibility(): number
  • set angularSensibility(value: number): any
  • Gets the input sensibility for mouse input. Higher values reduce sensitivity.

    Returns number

  • Sets the input sensibility for a mouse input. Higher values reduce sensitivity.

    Parameters

    • value: number

    Returns any

collisionMask

  • get collisionMask(): number
  • set collisionMask(mask: number): any
  • Get the mask that the camera ignores in collision events.

    Returns number

  • Set the mask that the camera ignores in collision events.

    Parameters

    • mask: number

    Returns any

keysBackward

  • get keysBackward(): number[]
  • set keysBackward(value: number[]): any
  • Get the keys for camera movement backward.

    Returns number[]

  • Get the keys for camera movement backward.

    Parameters

    • value: number[]

    Returns any

keysDown

  • get keysDown(): number[]
  • set keysDown(value: number[]): any
  • Get the keys for camera movement down.

    Returns number[]

  • Set the keys for camera movement down.

    Parameters

    • value: number[]

    Returns any

keysForward

  • get keysForward(): number[]
  • set keysForward(value: number[]): any
  • Get the keys for camera movement forward.

    Returns number[]

  • Set the keys for camera movement forward.

    Parameters

    • value: number[]

    Returns any

keysLeft

  • get keysLeft(): number[]
  • set keysLeft(value: number[]): any
  • Get the keys for camera movement left.

    Returns number[]

  • Set the keys for camera movement left.

    Parameters

    • value: number[]

    Returns any

keysRight

  • get keysRight(): number[]
  • set keysRight(value: number[]): any
  • Set the keys for camera movement right.

    Returns number[]

  • Set the keys for camera movement right.

    Parameters

    • value: number[]

    Returns any

keysUp

  • get keysUp(): number[]
  • set keysUp(value: number[]): any
  • Get the keys for camera movement up.

    Returns number[]

  • Set the keys for camera movement up.

    Parameters

    • value: number[]

    Returns any

target

  • Defines the target point of the camera. The camera looks towards it form the radius distance.

    Returns Vector3

  • Defines the target point of the camera. The camera looks towards it form the radius distance.

    Parameters

    Returns any

Methods

attachControlSearch playground for attachControl

  • attachControl(noPreventDefault?: boolean): void

detachControlSearch playground for detachControl

  • detachControl(): void
  • Detach a control from the HTML DOM element. The camera will stop reacting to that input.

    Returns void

disposeSearch playground for dispose

  • dispose(): void
  • Destroy the camera and release the current resources held by it.

    Returns void

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Get the current object class name.

    Returns string

    the class name.

getFrontPositionSearch playground for getFrontPosition

  • getFrontPosition(distance: number): Vector3
  • Gets the position in front of the camera at a given distance.

    Parameters

    • distance: number

      The distance from the camera we want the position to be

    Returns Vector3

    the position

getTargetSearch playground for getTarget

  • Return the current target position of the camera. This value is expressed in local space.

    Returns Vector3

    the target position

setTargetSearch playground for setTarget

  • Defines the target the camera should look at.

    Parameters

    • target: Vector3

      Defines the new target as a Vector

    Returns void

storeStateSearch playground for storeState

  • Store current camera state of the camera (fov, position, rotation, etc..)

    Returns Camera

    the camera

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Property
  • Method
  • Static property
  • Static method