FreeCamera

This represents a free type of camera. It can be useful in First Person Shooter game for instance. Please consider using the new UniversalCamera instead as it adds more functionality like the gamepad.

see

https://doc.babylonjs.com/features/cameras#universal-camera

Hierarchy

Index

Constructors

constructor

Find examples in Playground
  • new FreeCamera(name: string, position: Vector3, scene: Scene, setActiveOnSceneIfNoneActive?: boolean): FreeCamera
  • Instantiates a Free Camera. This represents a free type of camera. It can be useful in First Person Shooter game for instance. Please consider using the new UniversalCamera instead as it adds more functionality like touch to this camera.

    see

    https://doc.babylonjs.com/features/cameras#universal-camera

    Parameters

    • name: string

      Define the name of the camera in the scene

    • position: Vector3

      Define the start 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 not other active cameras have been defined

    Returns FreeCamera

Properties

applyGravity

Find examples in Playground
applyGravity: boolean

Enable or disable gravity on the camera.

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.

ellipsoid

Find examples in Playground
ellipsoid: Vector3

Define the collision ellipsoid of the camera. This is helpful to simulate a camera body like the player body around the camera

see

https://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 to determine the center of the body near the gravity center of the body instead of its head.

ignoreParentScaling

Find examples in Playground
ignoreParentScaling: boolean

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

inputs

Find examples in Playground

Define the input manager associated to the camera.

inverseRotationSpeed

Find examples in Playground
inverseRotationSpeed: number

Speed multiplier for inverse camera panning

invertRotation

Find examples in Playground
invertRotation: boolean

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

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 constraint 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 collide with a mesh in the scene.

Type declaration

rotation

Find examples in Playground
rotation: Vector3

Define the current rotation of the camera

rotationQuaternion

Find examples in Playground
rotationQuaternion: Quaternion

Define the current rotation of the camera as a quaternion to prevent Gimbal lock

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

Accessors

angularSensibility

Find examples in Playground
  • get angularSensibility(): number
  • set angularSensibility(value: number): any
  • Gets the input sensibility for a mouse input. (default is 2000.0) Higher values reduce sensitivity.

    Returns number

  • Sets the input sensibility for a mouse input. (default is 2000.0) Higher values reduce sensitivity.

    Parameters

    • value: number

    Returns any

collisionMask

Find examples in Playground
  • get collisionMask(): number
  • set collisionMask(mask: number): any
  • Define a collision mask to limit the list of object the camera can collide with

    Returns number

  • Define a collision mask to limit the list of object the camera can collide with

    Parameters

    • mask: number

    Returns any

keysDown

Find examples in Playground
  • get keysDown(): number[]
  • set keysDown(value: number[]): any
  • Gets or Set the list of keyboard keys used to control the backward move of the camera.

    Returns number[]

  • Gets or Set the list of keyboard keys used to control the backward move of the camera.

    Parameters

    • value: number[]

    Returns any

keysDownward

Find examples in Playground
  • get keysDownward(): number[]
  • set keysDownward(value: number[]): any
  • Gets or Set the list of keyboard keys used to control the downward move of the camera.

    Returns number[]

  • Gets or Set the list of keyboard keys used to control the downward move of the camera.

    Parameters

    • value: number[]

    Returns any

keysLeft

Find examples in Playground
  • get keysLeft(): number[]
  • set keysLeft(value: number[]): any
  • Gets or Set the list of keyboard keys used to control the left strafe move of the camera.

    Returns number[]

  • Gets or Set the list of keyboard keys used to control the left strafe move of the camera.

    Parameters

    • value: number[]

    Returns any

keysRight

Find examples in Playground
  • get keysRight(): number[]
  • set keysRight(value: number[]): any
  • Gets or Set the list of keyboard keys used to control the right strafe move of the camera.

    Returns number[]

  • Gets or Set the list of keyboard keys used to control the right strafe move of the camera.

    Parameters

    • value: number[]

    Returns any

keysUp

Find examples in Playground
  • get keysUp(): number[]
  • set keysUp(value: number[]): any
  • Gets or Set the list of keyboard keys used to control the forward move of the camera.

    Returns number[]

  • Gets or Set the list of keyboard keys used to control the forward move of the camera.

    Parameters

    • value: number[]

    Returns any

keysUpward

Find examples in Playground
  • get keysUpward(): number[]
  • set keysUpward(value: number[]): any
  • Gets or Set the list of keyboard keys used to control the upward move of the camera.

    Returns number[]

  • Gets or Set the list of keyboard keys used to control the upward move of the camera.

    Parameters

    • value: number[]

    Returns any

target

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

attachControl

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

detachControl

Find examples in Playground
  • detachControl(element: HTMLElement): void
  • Detach the current controls from the camera. The camera will stop reacting to inputs.

    Parameters

    • element: HTMLElement

      Defines the element to stop listening the inputs from

    Returns void

dispose

Find examples in Playground
  • dispose(): void
  • Destroy the camera and release the current resources hold 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