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

constructor

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

Find examples in Playground
angularSensibility: number

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

applyGravity

Find examples in Playground
applyGravity: boolean

Enable or disable gravity on the camera.

cameraDirection

Find examples in Playground
cameraDirection: Vector3

Define the current direction the camera is moving to

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

controllers

Find examples in Playground
controllers: Array<WebVRController>

References to the webVR controllers for the vrDevice.

devicePosition

Find examples in Playground
devicePosition: Vector3

Represents device position in babylon space.

deviceRotationQuaternion

Find examples in Playground
deviceRotationQuaternion: Quaternion

Represents device rotation in babylon space.

deviceScaleFactor

Find examples in Playground
deviceScaleFactor: number

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

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.

inputs

Find examples in Playground

Define the input manager associated to the camera.

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.

leftController

Find examples in Playground
leftController: Nullable<WebVRController>

The controller corresponding to the users left hand.

lockedTarget

Find examples in Playground
lockedTarget: any

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

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.

onCollide

Find examples in Playground
onCollide: function

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

Type declaration

onControllerMeshLoadedObservable

Find examples in Playground
onControllerMeshLoadedObservable: Observable<WebVRController>

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

onControllersAttachedObservable

Find examples in Playground
onControllersAttachedObservable: Observable<WebVRController[]>

Emits an event when a controller is attached.

onPoseUpdatedFromDeviceObservable

Find examples in Playground
onPoseUpdatedFromDeviceObservable: Observable<any>

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

rawPose

Find examples in Playground

The rawPose of the vrDevice.

rigParenting

Find examples in Playground
rigParenting: boolean

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

rightController

Find examples in Playground
rightController: Nullable<WebVRController>

The controller corresponding to the users right hand.

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

updateUpVectorFromRotation

Find examples in Playground
updateUpVectorFromRotation: boolean

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

Methods

attachControl

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

detachControl

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

    Parameters

    • element: HTMLElement

      html element to detach from

    Returns void

deviceDistanceToRoomGround

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

Find examples in Playground
  • dispose(): void

getClassName

Find examples in Playground
  • getClassName(): string

getControllerByName

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

getForwardRay

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

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

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

initControllers

Find examples in Playground
  • initControllers(): void
  • Initializes the controllers and their meshes

    Returns void

resetToCurrentRotation

Find examples in Playground
  • resetToCurrentRotation(): void

setTarget

Find examples in Playground
  • Defines the target the camera should look at.

    Parameters

    • target: Vector3

      Defines the new target as a Vector or a mesh

    Returns void

storeState

Find examples in Playground
  • Store current camera state of the camera (fov, position, rotation, etc..)

    Returns Camera

    the camera

update

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

    Returns void

updateFromDevice

Find examples in Playground

useStandingMatrix

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

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

Generated using TypeDoc