AnaglyphFreeCamera

Camera used to simulate anaglyphic rendering (based on FreeCamera)

see

http://doc.babylonjs.com/features/cameras#anaglyph-cameras

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

Find examples in Playground
  • Creates a new AnaglyphFreeCamera

    Parameters

    • name: string

      defines camera name

    • position: Vector3

      defines initial position

    • interaxialDistance: number

      defines distance between each color axis

    • scene: Scene

      defines the hosting scene

    Returns AnaglyphFreeCamera

Properties

angularSensibility

Find examples in Playground
angularSensibility: number

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

animationPropertiesOverride

Find examples in Playground
animationPropertiesOverride: Nullable<AnimationPropertiesOverride>

Gets or sets the animation properties override

animations

Find examples in Playground
animations: Animation[]

Gets a list of Animations associated with the node

applyGravity

Find examples in Playground
applyGravity: boolean

Enable or disable gravity on the camera.

behaviors

Find examples in Playground
behaviors: Behavior<Node>[]

Gets the list of attached behaviors

see

http://doc.babylonjs.com/features/behaviour

cameraDirection

Find examples in Playground
cameraDirection: Vector3

Define the current direction the camera is moving to

cameraRigMode

Find examples in Playground
cameraRigMode: number

Rig mode of the camera. This is usefull 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.

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

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

customRenderTargets

Find examples in Playground
customRenderTargets: RenderTargetTexture[]

Defines the list of custom render target the camera should render to. This is pretty helpfull if you wish to make a camera render to a texture you could reuse somewhere else in the scene.

doNotSerialize

Find examples in Playground
doNotSerialize: boolean

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

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

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

fov

Find examples in Playground
fov: number

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

fovMode

Find examples in Playground
fovMode: number

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

globalPosition

Find examples in Playground
globalPosition: Vector3

Gets the current world space position of the camera.

id

Find examples in Playground
id: string

Gets or sets the id of the node

inertia

Find examples in Playground
inertia: number

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

inputs

Find examples in Playground

Define the input manager associated to the camera.

interaxialDistance

Find examples in Playground
interaxialDistance: number

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

isIntermediate

Find examples in Playground
isIntermediate: boolean

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

isStereoscopicSideBySide

Find examples in Playground
isStereoscopicSideBySide: boolean

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

keysDown

Find examples in Playground
keysDown: number[]

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

keysLeft

Find examples in Playground
keysLeft: number[]

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

keysRight

Find examples in Playground
keysRight: number[]

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

keysUp

Find examples in Playground
keysUp: number[]

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

layerMask

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

leftCamera

Find examples in Playground
leftCamera: Nullable<FreeCamera>

Gets the left camera of a rig setup in case of Rigged Camera

lockedTarget

Find examples in Playground
lockedTarget: any

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

maxZ

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

metadata

Find examples in Playground
metadata: any

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

minZ

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

mode

Find examples in Playground
mode: number

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

name

Find examples in Playground
name: string

Gets or sets the name of the node

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.

onAfterCheckInputsObservable

Find examples in Playground
onAfterCheckInputsObservable: Observable<Camera>

Observable triggered when the inputs have been processed.

onCollide

Find examples in Playground
onCollide: function

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

Type declaration

onDispose

Find examples in Playground
onDispose: function

Sets a callback that will be raised when the node will be disposed

Type declaration

    • (): void
    • Returns void

onDisposeObservable

Find examples in Playground
onDisposeObservable: Observable<Node>

An event triggered when the mesh is disposed

onProjectionMatrixChangedObservable

Find examples in Playground
onProjectionMatrixChangedObservable: Observable<Camera>

Observable triggered when the camera Projection matrix has changed.

onReady

Find examples in Playground
onReady: function

Callback raised when the node is ready to be used

Type declaration

    • (node: Node): void
    • Parameters

      Returns void

onRestoreStateObservable

Find examples in Playground
onRestoreStateObservable: Observable<Camera>

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

onViewMatrixChangedObservable

Find examples in Playground
onViewMatrixChangedObservable: Observable<Camera>

Observable triggered when the camera view matrix has changed.

orthoBottom

Find examples in Playground
orthoBottom: Nullable<number>

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

orthoLeft

Find examples in Playground
orthoLeft: Nullable<number>

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

orthoRight

Find examples in Playground
orthoRight: Nullable<number>

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

orthoTop

Find examples in Playground
orthoTop: Nullable<number>

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

parent

Find examples in Playground
parent: Nullable<Node>

Gets or sets the parent of the node

position

Find examples in Playground
position: Vector3

Define the current local position of the camera in the scene

rigPostProcess

Find examples in Playground
rigPostProcess: Nullable<PostProcess>

Gets the post process used by the rig cameras

rightCamera

Find examples in Playground
rightCamera: Nullable<FreeCamera>

Gets the right camera of a rig setup in case of Rigged Camera

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

state

Find examples in Playground
state: string

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

uniqueId

Find examples in Playground
uniqueId: number

Gets or sets the unique id of the node

upVector

Find examples in Playground
upVector: Vector3

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

viewport

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

worldMatrixFromCache

Find examples in Playground
worldMatrixFromCache: Matrix

Returns directly the latest state of the mesh World matrix. A Matrix is returned.

Static FOVMODE_HORIZONTAL_FIXED

Find examples in Playground
FOVMODE_HORIZONTAL_FIXED: number

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

Static FOVMODE_VERTICAL_FIXED

Find examples in Playground
FOVMODE_VERTICAL_FIXED: number

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 ForceAttachControlToAlwaysPreventDefault

Find examples in Playground
ForceAttachControlToAlwaysPreventDefault: boolean

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

Static ORTHOGRAPHIC_CAMERA

Find examples in Playground
ORTHOGRAPHIC_CAMERA: number

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 PERSPECTIVE_CAMERA

Find examples in Playground
PERSPECTIVE_CAMERA: number

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 RIG_MODE_NONE

Find examples in Playground
RIG_MODE_NONE: number

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

Static RIG_MODE_STEREOSCOPIC_ANAGLYPH

Find examples in Playground
RIG_MODE_STEREOSCOPIC_ANAGLYPH: number

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

Static RIG_MODE_STEREOSCOPIC_OVERUNDER

Find examples in Playground
RIG_MODE_STEREOSCOPIC_OVERUNDER: number

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

Static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED

Find examples in Playground
RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number

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

Static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL

Find examples in Playground
RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number

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

Static RIG_MODE_VR

Find examples in Playground
RIG_MODE_VR: number

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

Static RIG_MODE_WEBVR

Find examples in Playground
RIG_MODE_WEBVR: number

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

Methods

addBehavior

Find examples in Playground

attachControl

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

attachPostProcess

Find examples in Playground

beginAnimation

Find examples in Playground
  • beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: function): 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: function

      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

clone

Find examples in Playground
  • Clones the current camera.

    Parameters

    • name: string

      The cloned camera name

    Returns Camera

    the cloned camera

computeWorldMatrix

Find examples in Playground
  • computeWorldMatrix(): Matrix

createAnimationRange

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

deleteAnimationRange

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

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

detachPostProcess

Find examples in Playground

dispose

Find examples in Playground
  • dispose(): void

freezeProjectionMatrix

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

getActiveMeshes

Find examples in Playground

getAnimationByName

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

getAnimationRange

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

getBehaviorByName

Find examples in Playground

getChildMeshes

Find examples in Playground
  • getChildMeshes(directDescendantsOnly?: boolean, predicate?: function): 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

    • Optional predicate: function

      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

getChildTransformNodes

Find examples in Playground
  • getChildTransformNodes(directDescendantsOnly?: boolean, predicate?: function): TransformNode[]
  • Get all child-transformNodes 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

    • Optional predicate: function

      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 TransformNode[]

    an array of TransformNode

getChildren

Find examples in Playground
  • getChildren(predicate?: function): Node[]
  • Get all direct children of this node

    Parameters

    • Optional predicate: function

      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[]

    an array of Node

getClassName

Find examples in Playground
  • getClassName(): string

getDescendants

Find examples in Playground
  • getDescendants(directDescendantsOnly?: boolean, predicate?: function): Node[]
  • 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: function

      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

getDirection

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

getDirectionToRef

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

getEngine

Find examples in Playground

getForwardRay

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

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

getLeftTarget

Find examples in Playground

getProjectionMatrix

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

getRightTarget

Find examples in Playground

getScene

Find examples in Playground

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

getTransformationMatrix

Find examples in Playground
  • getTransformationMatrix(): Matrix

getViewMatrix

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

getWorldMatrix

Find examples in Playground

isActiveMesh

Find examples in Playground
  • isActiveMesh(mesh: Mesh): boolean
  • Check wether 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

isCompletelyInFrustum

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

    Parameters

    Returns boolean

    true if the object is in frustum otherwise false

isDescendantOf

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

isDisposed

Find examples in Playground
  • isDisposed(): boolean
  • Gets a boolean indicating if the node has been disposed

    Returns boolean

    true if the node was disposed

isEnabled

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

isInFrustum

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

    Returns boolean

    true if the object is in frustum otherwise false

isReady

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

removeBehavior

Find examples in Playground

restoreState

Find examples in Playground
  • restoreState(): boolean
  • Restored camera state. You must call storeState() first.

    Returns boolean

    true if restored and false otherwise

serialize

Find examples in Playground
  • serialize(): any
  • Serialiaze the camera setup to a json represention

    Returns any

    the JSON representation

serializeAnimationRanges

Find examples in Playground
  • serializeAnimationRanges(): any

setEnabled

Find examples in Playground
  • setEnabled(value: boolean): void
  • Set the enabled state of this node

    Parameters

    • value: boolean

      defines the new enabled state

    Returns void

storeState

Find examples in Playground

toString

Find examples in Playground
  • toString(fullDetails?: boolean): string
  • Gets a string representation of the camera usefull for debug purpose.

    Parameters

    • Optional fullDetails: boolean

      Defines that a more verboe level of logging is required

    Returns string

    the string representation

unfreezeProjectionMatrix

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

    Returns void

update

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

    Returns void

Static AddNodeConstructor

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

Find examples in Playground
  • Construct(type: string, name: string, scene: Scene, options?: any): Nullable<function>
  • 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<function>

    the new constructor or null

Static GetConstructorFromName

Find examples in Playground
  • GetConstructorFromName(type: string, name: string, scene: Scene, interaxial_distance?: number, isStereoscopicSideBySide?: boolean): function
  • 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 function

    a factory method to construc the camera

Static Parse

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

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

Generated using TypeDoc