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

Find examples in Playground
  • 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.

    • scene: Scene

      Define the scene the camera belongs to.

    • Optional setActiveOnSceneIfNoneActive: boolean

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

    Returns FlyCamera

Properties

_trackRoll

Find examples in Playground
_trackRoll: number

Track Roll to maintain the wanted Rolling when looking around.

angularSensibility

Find examples in Playground
angularSensibility: number

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

applyGravity

Find examples in Playground
applyGravity: boolean

Enable or disable gravity on the camera.

bankedTurn

Find examples in Playground
bankedTurn: boolean

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

bankedTurnLimit

Find examples in Playground
bankedTurnLimit: number

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

bankedTurnMultiplier

Find examples in Playground
bankedTurnMultiplier: number

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

cameraDirection

Find examples in Playground
cameraDirection: Vector3

Define the current direction the camera is moving to.

cameraRotation

Find examples in Playground
cameraRotation: Vector2

Define the current rotation the camera is rotating to

checkCollisions

Find examples in Playground
checkCollisions: boolean

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

collisionMask

Find examples in Playground
collisionMask: number

Set the mask that the camera ignores in collision events.

ellipsoid

Find examples in Playground
ellipsoid: Vector3

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

see

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

ellipsoidOffset

Find examples in Playground
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.

inputs

Find examples in Playground

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

keysBackward

Find examples in Playground
keysBackward: number[]

Get the keys for camera movement backward.

keysDown

Find examples in Playground
keysDown: number[]

Set the keys for camera movement down.

keysForward

Find examples in Playground
keysForward: number[]

Set the keys for camera movement forward.

keysLeft

Find examples in Playground
keysLeft: number[]

Set the keys for camera movement left.

keysRight

Find examples in Playground
keysRight: number[]

Set the keys for camera movement right.

keysUp

Find examples in Playground
keysUp: number[]

Set the keys for camera movement up.

lockedTarget

Find examples in Playground
lockedTarget: any

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

noRotationConstraint

Find examples in Playground
noRotationConstraint: boolean

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

onCollide

Find examples in Playground
onCollide: function

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

Type declaration

rollCorrect

Find examples in Playground
rollCorrect: number

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

rotation

Find examples in Playground
rotation: Vector3

Define the current rotation of the camera

rotationQuaternion

Find examples in Playground
rotationQuaternion: Quaternion

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

speed

Find examples in Playground
speed: number

Define the current speed of the camera

updateUpVectorFromRotation

Find examples in Playground
updateUpVectorFromRotation: boolean

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

Methods

attachControl

Find examples in Playground
  • attachControl(element: HTMLElement, noPreventDefault?: boolean): void

detachControl

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

    Parameters

    • element: HTMLElement

      Defines the element that listens to the input events.

    Returns void

dispose

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

    Returns void

getClassName

Find examples in Playground
  • getClassName(): string

getFrontPosition

Find examples in Playground
  • 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

getTarget

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

    Returns Vector3

    the target position

setTarget

Find examples in Playground
  • Defines the target the camera should look at.

    Parameters

    • target: Vector3

      Defines the new target as a Vector or a mesh

    Returns void

storeState

Find examples in Playground
  • Store current camera state of the camera (fov, position, rotation, etc..)

    Returns Camera

    the camera

Generated using TypeDoc