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

Implements

Index

Constructors

Properties

Accessors

Methods

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.

animationsSearch playground for animations

animations: Animation[]

Gets a list of Animations associated with the node

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.

cameraRigModeSearch playground for cameraRigMode

cameraRigMode: number

Rig mode of the camera. This is useful to create the camera with two "eyes" instead of one to create VR or stereoscopic scenes. This is normally controlled byt the camera themselves as internal use.

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.

customRenderTargetsSearch playground for customRenderTargets

customRenderTargets: RenderTargetTexture[]

Defines the list of custom render target which are rendered to and then used as the input to this camera's render. Eg. display another camera view on a TV in the main scene This is pretty helpful if you wish to make a camera render to a texture you could reuse somewhere else in the scene. (Eg. security camera)

To change the final output target of the camera, camera.outputRenderTarget should be used instead (eg. webXR renders to a render target corresponding to an HMD)

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.

fovSearch playground for fov

fov: number

Field Of View is set in Radians. (default is 0.8)

fovModeSearch playground for fovMode

fovMode: number

fovMode sets the camera frustum bounds to the viewport bounds. (default is FOVMODE_VERTICAL_FIXED)

idSearch playground for id

id: string

Gets or sets the id of the node

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

inertiaSearch playground for inertia

inertia: number

Define the default inertia of the camera. This helps giving a smooth feeling to the camera movement.

inputsSearch playground for inputs

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

inspectableCustomPropertiesSearch playground for inspectableCustomProperties

inspectableCustomProperties: IInspectable[]

List of inspectable custom properties (used by the Inspector)

see

https://doc.babylonjs.com/how_to/debug_layer#extensibility

interaxialDistanceSearch playground for interaxialDistance

interaxialDistance: number

Defines the distance between both "eyes" in case of a RIG

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

isIntermediateSearch playground for isIntermediate

isIntermediate: boolean

Define whether the camera is intermediate. This is useful to not present the output directly to the screen in case of rig without post process for instance

isRigCameraSearch playground for isRigCamera

isRigCamera: boolean

Is this camera a part of a rig system?

isStereoscopicSideBySideSearch playground for isStereoscopicSideBySide

isStereoscopicSideBySide: boolean

Defines if stereoscopic rendering is done side by side or over under.

layerMaskSearch playground for layerMask

layerMask: number

Restricts the camera to viewing objects with the same layerMask. A camera with a layerMask of 1 will render mesh.layerMask & camera.layerMask!== 0

lockedTargetSearch playground for lockedTarget

lockedTarget: any

Define the current target of the camera as an object or a position. Please note that locking a target will disable panning.

maxZSearch playground for maxZ

maxZ: number

Define the maximum distance the camera can see to. This is important to note that the depth buffer are not infinite and the further it end the more your scene might encounter depth fighting issue.

metadataSearch playground for metadata

metadata: any

Gets or sets an object used to store user defined information for the node

minZSearch playground for minZ

minZ: number

Define the minimum distance the camera can see from. This is important to note that the depth buffer are not infinite and the closer it starts the more your scene might encounter depth fighting issue.

modeSearch playground for mode

mode: number

Define the mode of the camera (Camera.PERSPECTIVE_CAMERA or Camera.ORTHOGRAPHIC_CAMERA)

nameSearch playground for name

name: string

Gets or sets the name of the node

noRotationConstraintSearch playground for noRotationConstraint

noRotationConstraint: boolean

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

onAfterCheckInputsObservableSearch playground for onAfterCheckInputsObservable

onAfterCheckInputsObservable: Observable<Camera>

Observable triggered when the inputs have been processed.

onCollideSearch playground for onCollide

onCollide: (collidedMesh: AbstractMesh) => void

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

Type declaration

onDisposeObservableSearch playground for onDisposeObservable

onDisposeObservable: Observable<Node>

An event triggered when the mesh is disposed

onProjectionMatrixChangedObservableSearch playground for onProjectionMatrixChangedObservable

onProjectionMatrixChangedObservable: Observable<Camera>

Observable triggered when the camera Projection matrix has changed.

onReadySearch playground for onReady

onReady: Nullable<(node: Node) => void>

Callback raised when the node is ready to be used

onRestoreStateObservableSearch playground for onRestoreStateObservable

onRestoreStateObservable: Observable<Camera>

Observable triggered when reset has been called and applied to the camera.

onViewMatrixChangedObservableSearch playground for onViewMatrixChangedObservable

onViewMatrixChangedObservable: Observable<Camera>

Observable triggered when the camera view matrix has changed.

orthoBottomSearch playground for orthoBottom

orthoBottom: Nullable<number>

Define the current limit on the bottom side for an orthographic camera In scene unit

orthoLeftSearch playground for orthoLeft

orthoLeft: Nullable<number>

Define the current limit on the left side for an orthographic camera In scene unit

orthoRightSearch playground for orthoRight

orthoRight: Nullable<number>

Define the current limit on the right side for an orthographic camera In scene unit

orthoTopSearch playground for orthoTop

orthoTop: Nullable<number>

Define the current limit on the top side for an orthographic camera In scene unit

outputRenderTargetSearch playground for outputRenderTarget

outputRenderTarget: Nullable<RenderTargetTexture>

When set, the camera will render to this render target instead of the default canvas

If the desire is to use the output of a camera as a texture in the scene consider using camera.customRenderTargets instead

projectionPlaneTiltSearch playground for projectionPlaneTilt

projectionPlaneTilt: number

Projection plane tilt around the X axis (horizontal), set in Radians. (default is 0) Can be used to make vertical lines in world space actually vertical on the screen. See https://forum.babylonjs.com/t/add-vertical-shift-to-3ds-max-exporter-babylon-cameras/17480

renderPassIdSearch playground for renderPassId

renderPassId: number

Render pass id used by the camera to render into the main framebuffer

reservedDataStoreSearch playground for reservedDataStore

reservedDataStore: any

For internal use only. Please do not use.

Optional rigParentSearch playground for rigParent

rigParent: Camera

If isRigCamera set to true this will be set with the parent camera. The parent camera is not (!) necessarily the .parent of this camera (like in the case of XR)

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

stateSearch playground for state

state: string

Gets or sets a string used to store user defined state for the node

uniqueIdSearch playground for uniqueId

uniqueId: number

Gets or sets the unique id of the node

updateUpVectorFromRotationSearch playground for updateUpVectorFromRotation

updateUpVectorFromRotation: boolean

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

viewportSearch playground for viewport

viewport: Viewport

Define the viewport of the camera. This correspond to the portion of the screen the camera will render to in normalized 0 to 1 unit.

Static Readonly FOVMODE_HORIZONTAL_FIXEDSearch playground for FOVMODE_HORIZONTAL_FIXED

FOVMODE_HORIZONTAL_FIXED: 1 = 1

This setting aligns the left and right bounds of the viewport to the left and right bounds of the camera frustum.

Static Readonly FOVMODE_VERTICAL_FIXEDSearch playground for FOVMODE_VERTICAL_FIXED

FOVMODE_VERTICAL_FIXED: 0 = 0

This is the default FOV mode for perspective cameras. This setting aligns the upper and lower bounds of the viewport to the upper and lower bounds of the camera frustum.

Static ForceAttachControlToAlwaysPreventDefaultSearch playground for ForceAttachControlToAlwaysPreventDefault

ForceAttachControlToAlwaysPreventDefault: boolean

Defines if by default attaching controls should prevent the default javascript event to continue.

Static Readonly ORTHOGRAPHIC_CAMERASearch playground for ORTHOGRAPHIC_CAMERA

ORTHOGRAPHIC_CAMERA: 1 = 1

This helps creating camera with an orthographic mode. Orthographic is commonly used in engineering as a means to produce object specifications that communicate dimensions unambiguously, each line of 1 unit length (cm, meter..whatever) will appear to have the same length everywhere on the drawing. This allows the drafter to dimension only a subset of lines and let the reader know that other lines of that length on the drawing are also that length in reality. Every parallel line in the drawing is also parallel in the object.

Static Readonly PERSPECTIVE_CAMERASearch playground for PERSPECTIVE_CAMERA

PERSPECTIVE_CAMERA: 0 = 0

This is the default projection mode used by the cameras. It helps recreating a feeling of perspective and better appreciate depth. This is the best way to simulate real life cameras.

Static Readonly RIG_MODE_CUSTOMSearch playground for RIG_MODE_CUSTOM

RIG_MODE_CUSTOM: 22 = 22

Custom rig mode allowing rig cameras to be populated manually with any number of cameras

Static Readonly RIG_MODE_NONESearch playground for RIG_MODE_NONE

RIG_MODE_NONE: 0 = 0

This specifies there is no need for a camera rig. Basically only one eye is rendered corresponding to the camera.

Static Readonly RIG_MODE_STEREOSCOPIC_ANAGLYPHSearch playground for RIG_MODE_STEREOSCOPIC_ANAGLYPH

RIG_MODE_STEREOSCOPIC_ANAGLYPH: 10 = 10

Simulates a camera Rig with one blue eye and one red eye. This can be use with 3d blue and red glasses.

Static Readonly RIG_MODE_STEREOSCOPIC_INTERLACEDSearch playground for RIG_MODE_STEREOSCOPIC_INTERLACED

RIG_MODE_STEREOSCOPIC_INTERLACED: 14 = 14

Defines that both eyes of the camera will be rendered on successive lines interlaced for passive 3d monitors.

Static Readonly RIG_MODE_STEREOSCOPIC_OVERUNDERSearch playground for RIG_MODE_STEREOSCOPIC_OVERUNDER

RIG_MODE_STEREOSCOPIC_OVERUNDER: 13 = 13

Defines that both eyes of the camera will be rendered over under each other.

Static Readonly RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYEDSearch playground for RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED

RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: 12 = 12

Defines that both eyes of the camera will be rendered side by side with a none parallel target.

Static Readonly RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLELSearch playground for RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL

RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: 11 = 11

Defines that both eyes of the camera will be rendered side by side with a parallel target.

Static Readonly RIG_MODE_VRSearch playground for RIG_MODE_VR

RIG_MODE_VR: 20 = 20

Defines that both eyes of the camera should be renderered in a VR mode (carbox).

Static Readonly RIG_MODE_WEBVRSearch playground for RIG_MODE_WEBVR

RIG_MODE_WEBVR: 21 = 21

Defines that both eyes of the camera should be renderered in a VR mode (webVR).

Accessors

absoluteRotation

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

animationPropertiesOverride

behaviors

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

doNotSerialize

  • get doNotSerialize(): boolean
  • set doNotSerialize(value: boolean): any
  • Gets or sets a boolean used to define if the node must be serialized

    Returns boolean

  • Gets or sets a boolean used to define if the node must be serialized

    Parameters

    • value: boolean

    Returns any

globalPosition

isLeftCamera

  • get isLeftCamera(): boolean
  • Gets the left camera of a rig setup in case of Rigged Camera

    Returns boolean

isRightCamera

  • get isRightCamera(): boolean
  • Gets the right camera of a rig setup in case of Rigged Camera

    Returns boolean

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

leftCamera

onClonedObservable

onDispose

  • set onDispose(callback: () => void): any
  • Sets a callback that will be raised when the node will be disposed

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns any

onEnabledStateChangedObservable

  • get onEnabledStateChangedObservable(): Observable<boolean>

parent

position

  • Define the current local position of the camera in the scene

    Returns Vector3

  • Define the current local position of the camera in the scene

    Parameters

    Returns any

rigPostProcess

rightCamera

screenArea

  • get screenArea(): number
  • The screen area in scene units squared

    Returns number

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

upVector

  • The vector the camera should consider as up. (default is Vector3(0, 1, 0) aka Vector3.Up())

    Returns Vector3

  • The vector the camera should consider as up. (default is Vector3(0, 1, 0) aka Vector3.Up())

    Parameters

    Returns any

worldMatrixFromCache

  • get worldMatrixFromCache(): Matrix
  • Returns directly the latest state of the mesh World matrix. A Matrix is returned.

    Returns Matrix

Methods

_getFirstPostProcessSearch playground for _getFirstPostProcess

addBehaviorSearch playground for addBehavior

applyVerticalCorrectionSearch playground for applyVerticalCorrection

  • applyVerticalCorrection(): void
  • Automatically tilts the projection plane, using projectionPlaneTilt, to correct the perspective effect on vertical lines.

    Returns void

attachControlSearch playground for attachControl

  • attachControl(noPreventDefault?: boolean): void

attachPostProcessSearch playground for attachPostProcess

beginAnimationSearch playground for beginAnimation

  • beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Nullable<Animatable>
  • Will start the animation sequence

    Parameters

    • name: string

      defines the range frames for animation sequence

    • Optional loop: boolean

      defines if the animation should loop (false by default)

    • Optional speedRatio: number

      defines the speed factor in which to run the animation (1 by default)

    • Optional onAnimationEnd: () => void

      defines a function to be executed when the animation ended (undefined by default)

        • (): void
        • Returns void

    Returns Nullable<Animatable>

    the object created for this animation. If range does not exist, it will return null

cloneSearch playground for clone

  • Clones the current camera.

    Parameters

    • name: string

      The cloned camera name

    • Optional newParent: Nullable<Node>

      The cloned camera's new parent (none by default)

    Returns Camera

    the cloned camera

computeWorldMatrixSearch playground for computeWorldMatrix

  • computeWorldMatrix(): Matrix

createAnimationRangeSearch playground for createAnimationRange

  • createAnimationRange(name: string, from: number, to: number): void
  • Creates an animation range for this node

    Parameters

    • name: string

      defines the name of the range

    • from: number

      defines the starting key

    • to: number

      defines the end key

    Returns void

deleteAnimationRangeSearch playground for deleteAnimationRange

  • deleteAnimationRange(name: string, deleteFrames?: boolean): void
  • Delete a specific animation range

    Parameters

    • name: string

      defines the name of the range to delete

    • Optional deleteFrames: boolean

      defines if animation frames from the range must be deleted as well

    Returns 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

detachPostProcessSearch playground for detachPostProcess

disposeSearch playground for dispose

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

    Returns void

freezeProjectionMatrixSearch playground for freezeProjectionMatrix

  • freezeProjectionMatrix(projection?: Matrix): void
  • Freeze the projection matrix. It will prevent the cache check of the camera projection compute and can speed up perf if no parameter of the camera are meant to change

    Parameters

    • Optional projection: Matrix

      Defines manually a projection if necessary

    Returns void

getActiveMeshesSearch playground for getActiveMeshes

getAnimationByNameSearch playground for getAnimationByName

  • Get an animation by name

    Parameters

    • name: string

      defines the name of the animation to look for

    Returns Nullable<Animation>

    null if not found else the requested animation

getAnimationRangeSearch playground for getAnimationRange

  • Get an animation range by name

    Parameters

    • name: string

      defines the name of the animation range to look for

    Returns Nullable<AnimationRange>

    null if not found else the requested animation range

getAnimationRangesSearch playground for getAnimationRanges

getBehaviorByNameSearch playground for getBehaviorByName

getChildMeshesSearch playground for getChildMeshes

  • getChildMeshes<T>(directDescendantsOnly?: boolean, predicate?: (node: Node) => node is T): T[]
  • getChildMeshes(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[]
  • Get all child-meshes of this node

    Type parameters

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)

    • Optional predicate: (node: Node) => node is T

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): node is T
        • Parameters

          Returns node is T

    Returns T[]

    an array of AbstractMesh

  • Get all child-meshes of this node

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)

    • Optional predicate: (node: Node) => boolean

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): boolean
        • Parameters

          Returns boolean

    Returns AbstractMesh[]

    an array of AbstractMesh

getChildrenSearch playground for getChildren

  • getChildren<T>(predicate?: (node: Node) => node is T, directDescendantsOnly?: boolean): T[]
  • getChildren(predicate?: (node: Node) => boolean, directDescendantsOnly?: boolean): Node[]
  • Get all direct children of this node

    Type parameters

    Parameters

    • Optional predicate: (node: Node) => node is T

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): node is T
        • Parameters

          Returns node is T

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)

    Returns T[]

    an array of Node

  • Get all direct children of this node

    Parameters

    • Optional predicate: (node: Node) => boolean

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): boolean
        • Parameters

          Returns boolean

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)

    Returns Node[]

    an array of Node

getClassNameSearch playground for getClassName

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

    Returns string

    the class name.

getDescendantsSearch playground for getDescendants

  • getDescendants<T>(directDescendantsOnly?: boolean, predicate?: (node: Node) => node is T): T[]
  • getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[]
  • Will return all nodes that have this node as ascendant

    Type parameters

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optional predicate: (node: Node) => node is T

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): node is T
        • Parameters

          Returns node is T

    Returns T[]

    all children nodes of all types

  • Will return all nodes that have this node as ascendant

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optional predicate: (node: Node) => boolean

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): boolean
        • Parameters

          Returns boolean

    Returns Node[]

    all children nodes of all types

getDirectionSearch playground for getDirection

  • Gets the direction of the camera relative to a given local axis.

    Parameters

    • localAxis: Vector3

      Defines the reference axis to provide a relative direction.

    Returns Vector3

    the direction

getDirectionToRefSearch playground for getDirectionToRef

  • Gets the direction of the camera relative to a given local axis into a passed vector.

    Parameters

    • localAxis: Vector3

      Defines the reference axis to provide a relative direction.

    • result: Vector3

      Defines the vector to store the result in

    Returns void

getEngineSearch playground for getEngine

  • Gets the engine of the node

    Returns Engine

    a Engine

getForwardRaySearch playground for getForwardRay

  • Gets a ray in the forward direction from the camera.

    Parameters

    • Optional length: number

      Defines the length of the ray to create

    • Optional transform: Matrix

      Defines the transform to apply to the ray, by default the world matrix is used to create a workd space ray

    • Optional origin: Vector3

      Defines the start point of the ray which defaults to the camera position

    Returns Ray

    the forward ray

getForwardRayToRefSearch playground for getForwardRayToRef

  • Gets a ray in the forward direction from the camera.

    Parameters

    • refRay: Ray

      the ray to (re)use when setting the values

    • Optional length: number

      Defines the length of the ray to create

    • Optional transform: Matrix

      Defines the transform to apply to the ray, by default the world matrx is used to create a workd space ray

    • Optional origin: Vector3

      Defines the start point of the ray which defaults to the camera position

    Returns Ray

    the forward ray

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

getHierarchyBoundingVectorsSearch playground for getHierarchyBoundingVectors

  • Return the minimum and maximum world vectors of the entire hierarchy under current node

    Parameters

    • Optional includeDescendants: boolean

      Include bounding info from descendants as well (true by default)

    • Optional predicate: Nullable<(abstractMesh: AbstractMesh) => boolean>

      defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors

    Returns { max: Vector3; min: Vector3 }

    the new bounding vectors

getLeftTargetSearch playground for getLeftTarget

getProjectionMatrixSearch playground for getProjectionMatrix

  • getProjectionMatrix(force?: boolean): Matrix
  • Gets the current projection matrix of the camera.

    Parameters

    • Optional force: boolean

      forces the camera to recompute the matrix without looking at the cached state

    Returns Matrix

    the projection matrix

getRightTargetSearch playground for getRightTarget

getSceneSearch playground for getScene

  • Gets the scene of the node

    Returns Scene

    a scene

getTargetSearch playground for getTarget

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

    Returns Vector3

    the target position

getTransformationMatrixSearch playground for getTransformationMatrix

  • getTransformationMatrix(): Matrix

getViewMatrixSearch playground for getViewMatrix

  • getViewMatrix(force?: boolean): Matrix
  • Gets the current view matrix of the camera.

    Parameters

    • Optional force: boolean

      forces the camera to recompute the matrix without looking at the cached state

    Returns Matrix

    the view matrix

getWorldMatrixSearch playground for getWorldMatrix

isActiveMeshSearch playground for isActiveMesh

  • isActiveMesh(mesh: Mesh): boolean
  • Check whether a mesh is part of the current active mesh list of the camera

    Parameters

    • mesh: Mesh

      Defines the mesh to check

    Returns boolean

    true if active, false otherwise

isCompletelyInFrustumSearch playground for isCompletelyInFrustum

  • isCompletelyInFrustum(target: ICullable): boolean
  • Checks if a cullable object (mesh...) is in the camera frustum Unlike isInFrustum this checks the full bounding box

    Parameters

    Returns boolean

    true if the object is in frustum otherwise false

isDescendantOfSearch playground for isDescendantOf

  • isDescendantOf(ancestor: Node): boolean
  • Is this node a descendant of the given node? The function will iterate up the hierarchy until the ancestor was found or no more parents defined

    Parameters

    • ancestor: Node

      defines the parent node to inspect

    Returns boolean

    a boolean indicating if this node is a descendant of the given node

isDisposedSearch playground for isDisposed

  • isDisposed(): boolean
  • Gets a boolean indicating if the node has been disposed

    Returns boolean

    true if the node was disposed

isEnabledSearch playground for isEnabled

  • isEnabled(checkAncestors?: boolean): boolean
  • Is this node enabled? If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true

    Parameters

    • Optional checkAncestors: boolean

      indicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors

    Returns boolean

    whether this node (and its parent) is enabled

isInFrustumSearch playground for isInFrustum

  • isInFrustum(target: ICullable, checkRigCameras?: boolean): boolean
  • Checks if a cullable object (mesh...) is in the camera frustum This checks the bounding box center. See isCompletelyInFrustum for a full bounding check

    Parameters

    • target: ICullable

      The object to check

    • Optional checkRigCameras: boolean

      If the rig cameras should be checked (eg. with webVR camera both eyes should be checked) (Default: false)

    Returns boolean

    true if the object is in frustum otherwise false

isReadySearch playground for isReady

  • isReady(completeCheck?: boolean): boolean
  • Is this camera ready to be used/rendered

    Parameters

    • Optional completeCheck: boolean

      defines if a complete check (including post processes) has to be done (false by default)

    Returns boolean

    true if the camera is ready

markAsDirtySearch playground for markAsDirty

  • markAsDirty(property?: string): Node
  • Flag the node as dirty (Forcing it to update everything)

    Parameters

    • Optional property: string

      helps children apply precise "dirtyfication"

    Returns Node

    this node

removeBehaviorSearch playground for removeBehavior

restoreStateSearch playground for restoreState

  • restoreState(): boolean
  • Restored camera state. You must call storeState() first.

    Returns boolean

    true if restored and false otherwise

serializeSearch playground for serialize

  • serialize(): any
  • Serialiaze the camera setup to a json representation

    Returns any

    the JSON representation

serializeAnimationRangesSearch playground for serializeAnimationRanges

  • serializeAnimationRanges(): any
  • Serialize animation ranges into a JSON compatible object

    Returns any

    serialization object

setEnabledSearch playground for setEnabled

  • setEnabled(value: boolean): void
  • Set the enabled state of this node

    Parameters

    • value: boolean

      defines the new enabled state

    Returns void

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

toStringSearch playground for toString

  • toString(fullDetails?: boolean): string
  • Gets a string representation of the camera useful for debug purpose.

    Parameters

    • Optional fullDetails: boolean

      Defines that a more verbose level of logging is required

    Returns string

    the string representation

unfreezeProjectionMatrixSearch playground for unfreezeProjectionMatrix

  • unfreezeProjectionMatrix(): void
  • Unfreeze the projection matrix if it has previously been freezed by freezeProjectionMatrix.

    Returns void

updateSearch playground for update

  • update(): void
  • Update the camera state according to the different inputs gathered during the frame.

    Returns void

Static AddNodeConstructorSearch playground for AddNodeConstructor

  • Add a new node constructor

    Parameters

    • type: string

      defines the type name of the node to construct

    • constructorFunc: NodeConstructor

      defines the constructor function

    Returns void

Static ConstructSearch playground for Construct

  • Construct(type: string, name: string, scene: Scene, options?: any): Nullable<() => Node>
  • Returns a node constructor based on type name

    Parameters

    • type: string

      defines the type name

    • name: string

      defines the new node name

    • scene: Scene

      defines the hosting scene

    • Optional options: any

      defines optional options to transmit to constructors

    Returns Nullable<() => Node>

    the new constructor or null

Static GetConstructorFromNameSearch playground for GetConstructorFromName

  • GetConstructorFromName(type: string, name: string, scene: Scene, interaxial_distance?: number, isStereoscopicSideBySide?: boolean): () => Camera
  • Gets a camera constructor for a given camera type

    Parameters

    • type: string

      The type of the camera to construct (should be equal to one of the camera class name)

    • name: string

      The name of the camera the result will be able to instantiate

    • scene: Scene

      The scene the result will construct the camera in

    • Optional interaxial_distance: number

      In case of stereoscopic setup, the distance between both eyes

    • Optional isStereoscopicSideBySide: boolean

      In case of stereoscopic setup, should the sereo be side b side

    Returns () => Camera

    a factory method to construct the camera

Static ParseSearch playground for Parse

  • Parse a JSON and creates the camera from the parsed information

    Parameters

    • parsedCamera: any

      The JSON to parse

    • scene: Scene

      The scene to instantiate the camera in

    Returns Camera

    the newly constructed camera

Static ParseAnimationRangesSearch playground for ParseAnimationRanges

  • ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void
  • Parse animation range data from a serialization object and store them into a given node

    Parameters

    • node: Node

      defines where to store the animation ranges

    • parsedNode: any

      defines the serialization object to read data from

    • scene: Scene

      defines the hosting scene

    Returns void

Legend

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