VRExperienceHelper

Helps to quickly add VR support to an existing scene. See https://doc.babylonjs.com/how_to/webvr_helper

Hierarchy

  • VRExperienceHelper

Index

Constructors

constructor

Find examples in Playground
  • Instantiates a VRExperienceHelper. Helps to quickly add VR support to an existing scene.

    Parameters

    • scene: Scene

      The scene the VRExperienceHelper belongs to.

    • Optional webVROptions: VRExperienceHelperOptions

      Options to modify the vr experience helper's behavior.

    Returns VRExperienceHelper

Properties

enableGazeEvenWhenNoPointerLock

Find examples in Playground
enableGazeEvenWhenNoPointerLock: boolean

Gets or sets a boolean indicating that gaze can be enabled even if pointer lock is not engage (useful on iOS where fullscreen mode and pointer lock are not supported)

exitVROnDoubleTap

Find examples in Playground
exitVROnDoubleTap: boolean

Gets or sets a boolean indicating that the VREXperienceHelper will exit VR if double tap is detected

meshSelectionPredicate

Find examples in Playground
meshSelectionPredicate: function

To be optionaly changed by user to define custom selection logic (after ray selection)

Type declaration

onAfterCameraTeleport

Find examples in Playground
onAfterCameraTeleport: Observable<Vector3>

Observable raised after camera teleportation

onAfterEnteringVRObservable

Find examples in Playground
onAfterEnteringVRObservable: Observable<OnAfterEnteringVRObservableEvent>

Observable raised when entering VR has completed.

onBeforeCameraTeleport

Find examples in Playground
onBeforeCameraTeleport: Observable<Vector3>

Observable raised before camera teleportation

onControllerMeshLoadedObservable

Find examples in Playground
onControllerMeshLoadedObservable: Observable<WebVRController>

Observable raised when controller mesh is loaded.

onEnteringVRObservable

Find examples in Playground
onEnteringVRObservable: Observable<VRExperienceHelper>

Observable raised right before entering VR.

onExitingVRObservable

Find examples in Playground
onExitingVRObservable: Observable<VRExperienceHelper>

Observable raised when exiting VR.

onMeshSelectedWithController

Find examples in Playground
onMeshSelectedWithController: Observable<object>

Observable raised when a new mesh is selected based on meshSelectionPredicate. This observable will provide the mesh and the controller used to select the mesh

onNewMeshPicked

Find examples in Playground
onNewMeshPicked: Observable<PickingInfo>

Observable raised when a new mesh is picked based on meshSelectionPredicate

onNewMeshSelected

Find examples in Playground
onNewMeshSelected: Observable<AbstractMesh>

Observable raised when a new mesh is selected based on meshSelectionPredicate

onSelectedMeshUnselected

Find examples in Playground
onSelectedMeshUnselected: Observable<AbstractMesh>

Observable raised when current selected mesh gets unselected

raySelectionPredicate

Find examples in Playground
raySelectionPredicate: function

To be optionaly changed by user to define custom ray selection

Type declaration

requestPointerLockOnFullScreen

Find examples in Playground
requestPointerLockOnFullScreen: boolean

Defines whether or not Pointer lock should be requested when switching to full screen.

teleportationEnabled

Find examples in Playground
teleportationEnabled: boolean

Set teleportation enabled. If set to false camera teleportation will be disabled but camera rotation will be kept.

updateControllerLaserColor

Find examples in Playground
updateControllerLaserColor: boolean

If the controller laser color should be updated when selecting meshes

updateGazeTrackerColor

Find examples in Playground
updateGazeTrackerColor: boolean

If the gaze trackers color should be updated when selecting meshes

updateGazeTrackerScale

Find examples in Playground
updateGazeTrackerScale: boolean

If the gaze trackers scale should be updated to be constant size when pointing at near/far meshes

webVROptions

Find examples in Playground

Options to modify the vr experience helper's behavior.

xr

Find examples in Playground

If asking to force XR, this will be populated with the default xr experience

xrTestDone

Find examples in Playground
xrTestDone: boolean

Was the XR test done already. If this is true AND this.xr exists, xr is initialized. If this is true and no this.xr, xr exists but is not supported, using WebVR.

Static Readonly TELEPORTATIONMODE_CONSTANTSPEED

Find examples in Playground
TELEPORTATIONMODE_CONSTANTSPEED: number

Speed Constant Teleportation Mode

Static Readonly TELEPORTATIONMODE_CONSTANTTIME

Find examples in Playground
TELEPORTATIONMODE_CONSTANTTIME: number

Time Constant Teleportation Mode

Accessors

currentVRCamera

Find examples in Playground
  • Based on the current WebVR support, returns the current VR camera used.

    Returns Nullable<Camera>

deviceOrientationCamera

Find examples in Playground

displayGaze

Find examples in Playground
  • get displayGaze(): boolean
  • set displayGaze(value: boolean): any
  • If the ray of the gaze should be displayed.

    Returns boolean

  • Sets if the ray of the gaze should be displayed.

    Parameters

    • value: boolean

    Returns any

displayLaserPointer

Find examples in Playground
  • get displayLaserPointer(): boolean
  • set displayLaserPointer(value: boolean): any
  • If the ray of the LaserPointer should be displayed.

    Returns boolean

  • Sets if the ray of the LaserPointer should be displayed.

    Parameters

    • value: boolean

    Returns any

gazeTrackerMesh

Find examples in Playground
  • get gazeTrackerMesh(): Mesh
  • set gazeTrackerMesh(value: Mesh): any

isInVRMode

Find examples in Playground
  • get isInVRMode(): boolean
  • Gets a value indicating if we are currently in VR mode.

    Returns boolean

leftControllerGazeTrackerMesh

Find examples in Playground
  • The gaze tracking mesh corresponding to the left controller

    Returns Nullable<Mesh>

onControllerMeshLoaded

Find examples in Playground
  • Return this.onControllerMeshLoadedObservable Note: This one is for backward compatibility. Please use onControllerMeshLoadedObservable directly

    Returns Observable<WebVRController>

onEnteringVR

Find examples in Playground
  • Return this.onEnteringVRObservable Note: This one is for backward compatibility. Please use onEnteringVRObservable directly

    Returns Observable<VRExperienceHelper>

onExitingVR

Find examples in Playground
  • Return this.onExitingVRObservable Note: This one is for backward compatibility. Please use onExitingVRObservable directly

    Returns Observable<VRExperienceHelper>

position

Find examples in Playground
  • The position of the vr experience helper.

    Returns Vector3

  • Sets the position of the vr experience helper.

    Parameters

    Returns any

rightControllerGazeTrackerMesh

Find examples in Playground
  • The gaze tracking mesh corresponding to the right controller

    Returns Nullable<Mesh>

teleportationTarget

Find examples in Playground
  • get teleportationTarget(): Mesh
  • set teleportationTarget(value: Mesh): any
  • The mesh used to display where the user is going to teleport.

    Returns Mesh

  • Sets the mesh to be used to display where the user is going to teleport.

    Parameters

    Returns any

vrButton

Find examples in Playground
  • get vrButton(): Nullable<HTMLButtonElement>
  • The html button that is used to trigger entering into VR.

    Returns Nullable<HTMLButtonElement>

vrDeviceOrientationCamera

Find examples in Playground

webVRCamera

Find examples in Playground

Methods

addFloorMesh

Find examples in Playground
  • addFloorMesh(floorMesh: Mesh): void
  • Adds a floor mesh to be used for teleportation.

    Parameters

    • floorMesh: Mesh

      the mesh to be used for teleportation.

    Returns void

changeGazeColor

Find examples in Playground
  • changeGazeColor(color: Color3): void
  • Sets the color of the ray from the vr headsets gaze.

    Parameters

    • color: Color3

      new color for the ray.

    Returns void

changeLaserColor

Find examples in Playground
  • changeLaserColor(color: Color3): void
  • Sets the color of the laser ray from the vr controllers.

    Parameters

    • color: Color3

      new color for the ray.

    Returns void

dispose

Find examples in Playground
  • dispose(): void
  • Exits VR and disposes of the vr experience helper

    Returns void

enableInteractions

Find examples in Playground
  • enableInteractions(): void
  • Enables controllers and user interactions such as selecting and object or clicking on an object.

    Returns void

enableTeleportation

Find examples in Playground
  • Enables interactions and teleportation using the VR controllers and gaze.

    Parameters

    Returns void

enterVR

Find examples in Playground
  • enterVR(): void
  • Attempt to enter VR. If a headset is connected and ready, will request present on that. Otherwise, will use the fullscreen API.

    Returns void

exitVR

Find examples in Playground
  • exitVR(): void
  • Attempt to exit VR, or fullscreen.

    Returns void

getClassName

Find examples in Playground
  • getClassName(): string
  • Gets the name of the VRExperienceHelper class

    Returns string

    "VRExperienceHelper"

removeFloorMesh

Find examples in Playground
  • removeFloorMesh(floorMesh: Mesh): void
  • Removes a floor mesh from being used for teleportation.

    Parameters

    • floorMesh: Mesh

      the mesh to be removed.

    Returns void

setGazeColor

Find examples in Playground
  • Permanently set new colors for the gaze pointer

    Parameters

    • color: Color3

      the new gaze color

    • Optional pickedColor: Color3

      the new gaze color when picked mesh detected

    Returns void

setLaserColor

Find examples in Playground
  • Permanently set new colors for the laser pointer

    Parameters

    • color: Color3

      the new laser color

    • Optional pickedColor: Color3

      the new laser color when picked mesh detected

    Returns void

setLaserLightingState

Find examples in Playground
  • setLaserLightingState(enabled?: boolean): void
  • Set lighting enabled / disabled on the laser pointer of both controllers

    Parameters

    • Optional enabled: boolean

      should the lighting be enabled on the laser pointer

    Returns void

teleportCamera

Find examples in Playground
  • teleportCamera(location: Vector3): void
  • Teleports the users feet to the desired location

    Parameters

    • location: Vector3

      The location where the user's feet should be placed

    Returns void

Generated using TypeDoc