API

Class StereoscopicGamepadCamera

Camera used to simulate stereoscopic rendering (based on GamepadCamera)

Hierarchy (View Summary)

Index
animations: Animation[] = []

Gets a list of Animations associated with the node

applyGravity: boolean = false

Enable or disable gravity on the camera.

cameraDirection: Vector3 = ...

Define the current direction the camera is moving to

cameraRigMode: number = Camera.RIG_MODE_NONE

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.

cameraRotation: Vector2 = ...

Define the current rotation the camera is rotating to

checkCollisions: boolean = false

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

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)

ellipsoid: Vector3 = ...

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

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: number = 0.8

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

fovMode: number = Camera.FOVMODE_VERTICAL_FIXED

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

id: string

Gets or sets the id of the node

ignoreCameraMaxZ: boolean = false

Ignores camera maxZ when computing the projection matrix (ie. use 0 instead of maxZ), meaning objects won't be culled by the far plane

Define the input manager associated to the camera.

inspectableCustomProperties: IInspectable[]

List of inspectable custom properties (used by the Inspector)

interaxialDistance: number

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

inverseRotationSpeed: number = 0.2

Speed multiplier for inverse camera panning

invertRotation: boolean = false

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

isIntermediate: boolean = false

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

isRigCamera: boolean = false

Is this camera a part of a rig system?

isStereoscopicSideBySide: boolean

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

layerMask: number = 0x0fffffff

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

lockedTarget: any = null

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

maxZ: number = 10000.0

Define the maximum distance the camera can see to. (default is 10000) 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: any = null

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

minZ: number = 1

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.

Framerate-independent movement controller for the free camera, exposing the configurable InputMapper (movement.input) consulted by the free-camera input classes. Narrows the inherited TargetCamera.movement to TargetCameraMovement; the instance is created by the TargetCamera constructor.

name: string

Gets or sets the name of the node

noRotationConstraint: boolean = false

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

oblique: Nullable<IObliqueParams> = null

Object containing oblique projection values (only used with ORTHOGRAPHIC_CAMERA)

onAccessibilityTagChangedObservable: Observable<Nullable<IAccessibilityTag>> = ...

Observable fired when an accessibility tag is changed

onAfterCheckInputsObservable: Observable<Camera> = ...

Observable triggered when the inputs have been processed.

onCollide: (collidedMesh: AbstractMesh) => void

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

onDisposeObservable: Observable<Node> = ...

An event triggered when the mesh is disposed

onProjectionMatrixChangedObservable: Observable<Camera> = ...

Observable triggered when the camera Projection matrix has changed.

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

Callback raised when the node is ready to be used

onRestoreStateObservable: Observable<Camera> = ...

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

onViewMatrixChangedObservable: Observable<Camera> = ...

Observable triggered when the camera view matrix has changed. Beware of reentrance! Some methods like Camera.getViewMatrix and Camera.getWorldMatrix can trigger the onViewMatrixChangedObservable observable, so using them inside an observer will require additional logic to avoid a stack overflow error.

outputRenderTarget: Nullable<RenderTargetTexture> = null

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

projectionPlaneTilt: number = 0

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

renderPassId: number

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

reservedDataStore: any = null

For internal use only. Please do not use.

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)

rotation: Vector3

Define the current rotation of the camera

rotationQuaternion: Nullable<Quaternion>

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

speed: number = 2.0

Define the current speed of the camera

state: string = ""

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

uniqueId: number

Gets or sets the unique id of the node

updateUpVectorFromRotation: boolean = false

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

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.

ForceAttachControlToAlwaysPreventDefault: boolean = false

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

FOVMODE_HORIZONTAL_FIXED: 1 = Constants.FOVMODE_HORIZONTAL_FIXED

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

FOVMODE_VERTICAL_FIXED: 0 = Constants.FOVMODE_VERTICAL_FIXED

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.

ORTHOGRAPHIC_CAMERA: 1 = Constants.ORTHOGRAPHIC_CAMERA

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.

PERSPECTIVE_CAMERA: 0 = Constants.PERSPECTIVE_CAMERA

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.

RIG_MODE_CUSTOM: 22 = Constants.RIG_MODE_CUSTOM

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

RIG_MODE_NONE: 0 = Constants.RIG_MODE_NONE

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

RIG_MODE_STEREOSCOPIC_ANAGLYPH: 10 = Constants.RIG_MODE_STEREOSCOPIC_ANAGLYPH

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

RIG_MODE_STEREOSCOPIC_INTERLACED: 14 = Constants.RIG_MODE_STEREOSCOPIC_INTERLACED

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

RIG_MODE_STEREOSCOPIC_OVERUNDER: 13 = Constants.RIG_MODE_STEREOSCOPIC_OVERUNDER

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

RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: 12 = Constants.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED

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

RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: 11 = Constants.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL

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

RIG_MODE_VR: 20 = Constants.RIG_MODE_VR

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

  • get angularSensibility(): number

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

    Returns number

  • set angularSensibility(value: number): void

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

    Parameters

    • value: number

    Returns void

  • get doNotSerialize(): boolean

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

    Returns boolean

  • set doNotSerialize(value: boolean): void

    Parameters

    • value: boolean

    Returns void

  • get inertia(): number

    Defines the inertia (decay coefficient applied per reference frame at 60fps) of the camera. This helps giving a smooth feeling to the camera movement.

    Override of Camera.inertia that writes through to the movement system so the framerate-independent pan/rotation glide stays in sync. Setting this updates the movement system immediately (matching the accessor convergence used by ArcRotateCamera).

    Backed by a local field rather than super.inertia: the shipped UMD bundle is compiled with TypeScript at target: ES5, and ES5 downleveling of super access inside a decorated accessor (the base Camera.inertia carries @serialize()) mis-compiles to undefined. That would feed NaN into the movement decay and freeze the camera. It only breaks in the ES5 UMD bundle; native-ESM dev keeps real super. See the babylonjs/no-super-in-accessor lint rule.

    Returns number

  • set inertia(value: number): void

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

    Parameters

    • value: number

    Returns void

  • get inheritVisibility(): boolean

    If set to true, this node, when renderable, will only be visible if its parent(s) are also visible.

    Returns boolean

    false
    
  • set inheritVisibility(value: boolean): void

    Parameters

    • value: boolean

    Returns void

  • get isVisible(): boolean

    Gets or sets a boolean indicating whether this node is visible, either this node itself when it is renderable or its renderable child nodes when inheritVisibility is true.

    Returns boolean

    true
    
  • set isVisible(value: boolean): void

    Parameters

    • value: boolean

    Returns void

  • set onDispose(callback: () => void): void

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

    Parameters

    • callback: () => void

    Returns void

  • get onEffectiveEnabledStateChangedObservable(): Observable<boolean>

    An event triggered when the effective enabled state of the node changes, i.e. whenever the value returned by isEnabled changes. Unlike onEnabledStateChangedObservable, this fires for changes caused by an ancestor's enabled state as well as this node's own state. The observable is created on first access, so no cost is incurred for nodes that never observe it.

    Returns Observable<boolean>

  • get worldMatrixFromCache(): Matrix

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

    Returns Matrix

  • Will start the animation sequence

    Parameters

    • name: string

      defines the range frames for animation sequence

    • Optionalloop: boolean

      defines if the animation should loop (false by default)

    • OptionalspeedRatio: number

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

    • OptionalonAnimationEnd: () => void

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

    Returns Nullable<Animatable>

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

  • 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

  • Delete a specific animation range

    Parameters

    • name: string

      defines the name of the range to delete

    • deleteFrames: boolean = true

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

    Returns void

  • Get all child-meshes of this node

    Type Parameters

    Parameters

    • OptionaldirectDescendantsOnly: 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)

    • Optionalpredicate: (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

    Returns T[]

    an array of AbstractMesh

  • Get all child-meshes of this node

    Parameters

    • OptionaldirectDescendantsOnly: 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)

    • Optionalpredicate: (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

    Returns AbstractMesh[]

    an array of AbstractMesh

  • Get all direct children of this node

    Type Parameters

    Parameters

    • Optionalpredicate: (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

    • OptionaldirectDescendantsOnly: 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

    • Optionalpredicate: (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

    • OptionaldirectDescendantsOnly: 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

  • Will return all nodes that have this node as ascendant

    Type Parameters

    Parameters

    • OptionaldirectDescendantsOnly: 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

    • Optionalpredicate: (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

    Returns T[]

    all children nodes of all types

  • Will return all nodes that have this node as ascendant

    Parameters

    • OptionaldirectDescendantsOnly: 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

    • Optionalpredicate: (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

    Returns Node[]

    all children nodes of all types

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

    Parameters

    • length: number = 100

      Defines the length of the ray to create

    • Optionaltransform: Matrix

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

    • Optionalorigin: Vector3

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

    Returns Ray

    the forward ray

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

    Parameters

    • refRay: Ray

      the ray to (re)use when setting the values

    • length: number = 100

      Defines the length of the ray to create

    • Optionaltransform: Matrix

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

    • Optionalorigin: Vector3

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

    Returns Ray

    the forward ray

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

    Parameters

    • includeDescendants: boolean = true

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

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

      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

  • 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

  • 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

    • checkAncestors: boolean = true

      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

    To observe changes to the value returned when calling this with checkAncestors set to true (the default, i.e. the effective enabled state), subscribe to onEffectiveEnabledStateChangedObservable. To observe changes to the value returned when calling this with checkAncestors set to false (i.e. this node's own enabled state only), subscribe to onEnabledStateChangedObservable.

  • 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

    • checkRigCameras: boolean = false

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

    Returns boolean

    true if the object is in frustum otherwise false

  • Is this camera ready to be used/rendered

    Parameters

    • completeCheck: boolean = false

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

    Returns boolean

    true if the camera is ready

  • Sets the camera's field of view in radians based on the focal length and sensor size.

    Parameters

    • value: number

      the focal length of the camera in mm.

    • sensorSize: number = 36

      the sensor width size of the camera in mm. (default is 36mm, which is a full frame sensor)

    Returns void

  • 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

    • Optionaloptions: any

      defines optional options to transmit to constructors

    Returns Nullable<() => Node>

    the new constructor or null

  • 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

    • interaxial_distance: number = 0

      In case of stereoscopic setup, the distance between both eyes

    • isStereoscopicSideBySide: boolean = true

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

    Returns () => Camera

    a factory method to construct the camera

  • 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