Options
All
  • Public
  • Public/Protected
  • All
Menu

Class 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.

deprecated

Use WebXR instead - https://doc.babylonjs.com/divingDeeper/webXR

example

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

Hierarchy

Implements

Index

Constructors

constructor

  • Instantiates a WebVRFreeCamera.

    Parameters

    • name: string

      The name of the WebVRFreeCamera

    • position: Vector3

      The starting anchor position for the camera

    • Optional scene: Scene

      The scene the camera belongs to

    • Optional webVROptions: WebVROptions

      a set of customizable options for the webVRCamera

    Returns WebVRFreeCamera

Properties

applyGravitySearch playground for applyGravity

applyGravity: boolean

Enable or disable gravity on the camera.

cameraDirectionSearch playground for cameraDirection

cameraDirection: Vector3

Define the current direction the camera is moving to

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.

controllersSearch playground for controllers

controllers: Array<WebVRController>

References to the webVR controllers for the vrDevice.

devicePositionSearch playground for devicePosition

devicePosition: Vector3

Represents device position in babylon space.

deviceRotationQuaternionSearch playground for deviceRotationQuaternion

deviceRotationQuaternion: Quaternion

Represents device rotation in babylon space.

deviceScaleFactorSearch playground for deviceScaleFactor

deviceScaleFactor: number

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

ellipsoidSearch playground for ellipsoid

ellipsoid: Vector3

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

see

https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#arcrotatecamera

ellipsoidOffsetSearch playground for ellipsoidOffset

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.

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

inputsSearch playground for inputs

Define the input manager associated to the camera.

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

lockedTargetSearch playground for lockedTarget

lockedTarget: any

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

noRotationConstraintSearch playground for noRotationConstraint

noRotationConstraint: boolean

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

onCollideSearch playground for onCollide

onCollide: (collidedMesh: AbstractMesh) => void

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

Type declaration

onControllerMeshLoadedObservableSearch playground for onControllerMeshLoadedObservable

onControllerMeshLoadedObservable: Observable<WebVRController>

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

onControllersAttachedObservableSearch playground for onControllersAttachedObservable

onControllersAttachedObservable: Observable<WebVRController[]>

Emits an event when a controller is attached.

onPoseUpdatedFromDeviceObservableSearch playground for onPoseUpdatedFromDeviceObservable

onPoseUpdatedFromDeviceObservable: Observable<any>

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

rawPoseSearch playground for rawPose

The rawPose of the vrDevice.

rigParentingSearch playground for rigParenting

rigParenting: boolean

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

rotationSearch playground for rotation

rotation: Vector3

Define the current rotation of the camera

rotationQuaternionSearch playground for rotationQuaternion

rotationQuaternion: Quaternion

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

speedSearch playground for speed

speed: number

Define the current speed of the camera

updateUpVectorFromRotationSearch playground for updateUpVectorFromRotation

updateUpVectorFromRotation: boolean

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

Accessors

angularSensibility

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

    Returns number

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

    Parameters

    • value: number

    Returns any

collisionMask

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

    Returns number

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

    Parameters

    • mask: number

    Returns any

keysDown

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

    Returns number[]

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

    Parameters

    • value: number[]

    Returns any

keysDownward

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

    Returns number[]

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

    Parameters

    • value: number[]

    Returns any

keysLeft

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

    Returns number[]

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

    Parameters

    • value: number[]

    Returns any

keysRight

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

    Returns number[]

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

    Parameters

    • value: number[]

    Returns any

keysRotateLeft

  • get keysRotateLeft(): number[]
  • set keysRotateLeft(value: number[]): any
  • Gets or Set the list of keyboard keys used to control the left rotation move of the camera.

    Returns number[]

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

    Parameters

    • value: number[]

    Returns any

keysRotateRight

  • get keysRotateRight(): number[]
  • set keysRotateRight(value: number[]): any
  • Gets or Set the list of keyboard keys used to control the right rotation move of the camera.

    Returns number[]

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

    Parameters

    • value: number[]

    Returns any

keysUp

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

    Returns number[]

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

    Parameters

    • value: number[]

    Returns any

keysUpward

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

    Returns number[]

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

    Parameters

    • value: number[]

    Returns any

leftController

  • The controller corresponding to the users left hand.

    Returns Nullable<WebVRController>

rightController

  • The controller corresponding to the users right hand.

    Returns Nullable<WebVRController>

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

Methods

attachControlSearch playground for attachControl

  • attachControl(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

    • Optional noPreventDefault: boolean

      prevent the default html element operation when attaching the vrDevice

    Returns void

detachControlSearch playground for detachControl

  • detachControl(): void
  • Detach the current controls from the specified dom element.

    Returns void

deviceDistanceToRoomGroundSearch playground for 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.

disposeSearch playground for dispose

  • dispose(): void
  • Disposes the camera

    Returns void

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Returns string

    the name of this class

getControllerByNameSearch playground for 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

getForwardRaySearch playground for 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 corresponding to the gaze

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

getTargetSearch playground for getTarget

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

    Returns Vector3

    the target position

initControllersSearch playground for initControllers

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

    Returns void

resetToCurrentRotationSearch playground for resetToCurrentRotation

  • resetToCurrentRotation(): 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

  • Store current camera state of the camera (fov, position, rotation, etc..)

    Returns Camera

    the camera

updateSearch playground for update

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

    Returns void

updateFromDeviceSearch playground for updateFromDevice

  • Updates the poseControlled values based on the input device pose.

    Parameters

    • poseData: DevicePose

      Pose coming from the device

    Returns void

useStandingMatrixSearch playground for useStandingMatrix

  • useStandingMatrix(callback?: (bool: boolean) => void): 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: (bool: boolean) => void

      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

useStandingMatrixAsyncSearch playground for 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.

Legend

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