WebVRFreeCamera

This represents a WebVR camera. The WebVR camera is Babylon's simple interface to interaction with Windows Mixed Reality, HTC Vive and Oculus Rift.

example

http://doc.babylonjs.com/how_to/webvr_camera

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • Instantiates a WebVRFreeCamera.

    Parameters

    • name: string

      The name of the WebVRFreeCamera

    • position: Vector3

      The starting anchor position for the camera

    • scene: Scene

      The scene the camera belongs to

    • Optional webVROptions: WebVROptions

      a set of customizable options for the webVRCamera

    Returns WebVRFreeCamera

Properties

angularSensibility

angularSensibility: number

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

animationPropertiesOverride

animationPropertiesOverride: Nullable<AnimationPropertiesOverride>

Gets or sets the animation properties override

animations

animations: Animation[]

Gets a list of Animations associated with the node

applyGravity

applyGravity: boolean

behaviors

behaviors: Behavior<Node>[]

Gets the list of attached behaviors

see

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

cameraDirection

cameraDirection: Vector3

cameraRigMode

cameraRigMode: number

cameraRotation

cameraRotation: Vector2

checkCollisions

checkCollisions: boolean

collisionMask

collisionMask: number

controllers

controllers: Array<WebVRController>

References to the webVR controllers for the vrDevice.

customRenderTargets

customRenderTargets: RenderTargetTexture[]

devicePosition

devicePosition: Vector3

Represents device position in babylon space.

deviceRotationQuaternion

deviceRotationQuaternion: Quaternion

Represents device rotation in babylon space.

deviceScaleFactor

deviceScaleFactor: number

The scale of the device to be used when translating from device space to babylon space.

doNotSerialize

doNotSerialize: boolean

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

ellipsoid

ellipsoid: Vector3

ellipsoidOffset

ellipsoidOffset: Vector3

fov

fov: number

FOV is set in Radians. (default is 0.8)

fovMode

fovMode: number

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

globalPosition

globalPosition: Vector3

id

id: string

Gets or sets the id of the node

inertia

inertia: number

inputs

interaxialDistance

interaxialDistance: number

isIntermediate

isIntermediate: boolean

isStereoscopicSideBySide

isStereoscopicSideBySide: boolean

keysDown

keysDown: number[]

keysLeft

keysLeft: number[]

keysRight

keysRight: number[]

keysUp

keysUp: number[]

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

leftCamera

leftCamera: Nullable<FreeCamera>

leftController

leftController: Nullable<WebVRController>

The controller corrisponding to the users left hand.

lockedTarget

lockedTarget: any

maxZ

maxZ: number

metadata

metadata: any

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

minZ

minZ: number

mode

mode: number

name

name: string

Gets or sets the name of the node

noRotationConstraint

noRotationConstraint: boolean

onAfterCheckInputsObservable

onAfterCheckInputsObservable: Observable<Camera>

onCollide

onCollide: function

Type declaration

onControllerMeshLoadedObservable

onControllerMeshLoadedObservable: Observable<WebVRController>

Emits an event when a controller's mesh has been loaded;

onControllersAttachedObservable

onControllersAttachedObservable: Observable<WebVRController[]>

Emits an event when a controller is attached.

onDispose

onDispose: function

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

Type declaration

    • (): void
    • Returns void

onDisposeObservable

onDisposeObservable: Observable<Node>

An event triggered when the mesh is disposed

onPoseUpdatedFromDeviceObservable

onPoseUpdatedFromDeviceObservable: Observable<any>

Emits an event when the HMD's pose has been updated.

onProjectionMatrixChangedObservable

onProjectionMatrixChangedObservable: Observable<Camera>

onReady

onReady: function

Callback raised when the node is ready to be used

Type declaration

    • (node: Node): void
    • Parameters

      Returns void

onRestoreStateObservable

onRestoreStateObservable: Observable<Camera>

onViewMatrixChangedObservable

onViewMatrixChangedObservable: Observable<Camera>

orthoBottom

orthoBottom: Nullable<number>

orthoLeft

orthoLeft: Nullable<number>

orthoRight

orthoRight: Nullable<number>

orthoTop

orthoTop: Nullable<number>

parent

parent: Nullable<Node>

Gets or sets the parent of the node

position

position: Vector3

rawPose

The rawPose of the vrDevice.

rigCameras

rigCameras: Camera[]

rigParenting

rigParenting: boolean

If the rig cameras be used as parent instead of this camera.

rigPostProcess

rigPostProcess: Nullable<PostProcess>

rightCamera

rightCamera: Nullable<FreeCamera>

rightController

rightController: Nullable<WebVRController>

The controller corrisponding to the users right hand.

rotation

rotation: Vector3

rotationQuaternion

rotationQuaternion: Quaternion

speed

speed: number

state

state: string

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

uniqueId

uniqueId: number

Gets or sets the unique id of the node

upVector

upVector: Vector3

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

viewport

viewport: Viewport

Static FOVMODE_HORIZONTAL_FIXED

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

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

ForceAttachControlToAlwaysPreventDefault: boolean

Static ORTHOGRAPHIC_CAMERA

ORTHOGRAPHIC_CAMERA: number

Static PERSPECTIVE_CAMERA

PERSPECTIVE_CAMERA: number

Static RIG_MODE_NONE

RIG_MODE_NONE: number

Static RIG_MODE_STEREOSCOPIC_ANAGLYPH

RIG_MODE_STEREOSCOPIC_ANAGLYPH: number

Static RIG_MODE_STEREOSCOPIC_OVERUNDER

RIG_MODE_STEREOSCOPIC_OVERUNDER: number

Static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED

RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number

Static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL

RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number

Static RIG_MODE_VR

RIG_MODE_VR: number

Static RIG_MODE_WEBVR

RIG_MODE_WEBVR: number

Static UseAlternateWebVRRendering

UseAlternateWebVRRendering: boolean

Methods

addBehavior

attachControl

  • attachControl(element: HTMLElement, noPreventDefault?: boolean): void
  • WebVR's attach control will start broadcasting frames to the device. Note that in certain browsers (chrome for example) this function must be called within a user-interaction callback. Example:

     scene.onPointerDown = function() { camera.attachControl(canvas); }

    Parameters

    • element: HTMLElement

      html element to attach the vrDevice to

    • Optional noPreventDefault: boolean

      prevent the default html element operation when attaching the vrDevice

    Returns void

attachPostProcess

beginAnimation

  • 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

computeWorldMatrix

  • computeWorldMatrix(): Matrix

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

createRigCamera

  • createRigCamera(name: string, cameraIndex: number): Nullable<Camera>

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

detachControl

  • detachControl(element: HTMLElement): void
  • Detaches the camera from the html element and disables VR

    Parameters

    • element: HTMLElement

      html element to detach from

    Returns void

detachPostProcess

deviceDistanceToRoomGround

  • deviceDistanceToRoomGround(): number
  • Gets the device distance from the ground in meters.

    Returns number

    the distance in meters from the vrDevice to ground in device space. If standing matrix is not supported for the vrDevice 0 is returned.

dispose

  • dispose(): void

freezeProjectionMatrix

  • freezeProjectionMatrix(projection?: Matrix): void

getActiveMeshes

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

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

getBehaviorByName

getChildMeshes

  • 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 {BABYLON.AbstractMesh}

getChildTransformNodes

  • 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 {BABYLON.TransformNode}

getChildren

  • 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 {BABYLON.Node}

getClassName

  • getClassName(): string

getControllerByName

  • Gets a vrController by name.

    Parameters

    • name: string

      The name of the controller to retreive

    Returns Nullable<WebVRController>

    the controller matching the name specified or null if not found

getDescendants

  • 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

getDirectionToRef

getEngine

getForwardRay

  • getForwardRay(length?: number): Ray
  • Casts a ray forward from the vrCamera's gaze.

    Parameters

    • Optional length: number

      Length of the ray (default: 100)

    Returns Ray

    the ray corrisponding to the gaze

getFrontPosition

  • getFrontPosition(distance: number): Vector3

getLeftTarget

getProjectionMatrix

  • getProjectionMatrix(force?: boolean): Matrix

getRightTarget

getScene

  • Gets the scene of the node

    Returns Scene

    a {BABYLON.Scene}

getTarget

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

    Returns Vector3

getTransformationMatrix

  • getTransformationMatrix(): Matrix

getViewMatrix

  • getViewMatrix(force?: boolean): Matrix

getWorldMatrix

initControllers

  • initControllers(): void
  • Initializes the controllers and their meshes

    Returns void

isActiveMesh

  • isActiveMesh(mesh: Mesh): boolean

isCompletelyInFrustum

  • isCompletelyInFrustum(target: ICullable): boolean

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

isDisposed

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

    Returns boolean

    true if the node was disposed

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

isInFrustum

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

removeBehavior

resetToCurrentRotation

  • resetToCurrentRotation(): void

restoreState

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

    Returns boolean

serialize

  • serialize(): any
  • May need to be overridden by children

    Returns any

serializeAnimationRanges

  • serializeAnimationRanges(): any

setCameraRigMode

  • setCameraRigMode(mode: number, rigParams: any): void

setCameraRigParameter

  • setCameraRigParameter(name: string, value: any): void

setEnabled

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

    Parameters

    • value: boolean

      defines the new enabled state

    Returns void

setTarget

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

    Parameters

    Returns void

    whether it was successful or not

storeState

toString

  • toString(fullDetails?: boolean): string
  • Parameters

    • Optional fullDetails: boolean

      support for multiple levels of logging within scene loading

    Returns string

unfreezeProjectionMatrix

  • unfreezeProjectionMatrix(): void

update

  • update(): void
  • Updates the current device position and rotation in the babylon world

    Returns void

updateFromDevice

useStandingMatrix

  • useStandingMatrix(callback?: function): void
  • Enables the standing matrix when supported. This can be used to position the user's view the correct height from the ground.

    Parameters

    • Optional callback: function

      will be called when the standing matrix is set. Callback parameter is if the standing matrix is supported.

        • (bool: boolean): void
        • Parameters

          • bool: boolean

          Returns void

    Returns void

useStandingMatrixAsync

  • useStandingMatrixAsync(): Promise<boolean>
  • Enables the standing matrix when supported. This can be used to position the user's view the correct height from the ground.

    Returns Promise<boolean>

    A promise with a boolean set to if the standing matrix is supported.

Static 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 Construct

  • 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

  • GetConstructorFromName(type: string, name: string, scene: Scene, interaxial_distance?: number, isStereoscopicSideBySide?: boolean): function

Static Parse

Static 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

Generated using TypeDoc