Options
All
  • Public
  • Public/Protected
  • All
Menu

Class 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

  • 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

enableGazeEvenWhenNoPointerLockSearch playground for enableGazeEvenWhenNoPointerLock

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)

exitVROnDoubleTapSearch playground for exitVROnDoubleTap

exitVROnDoubleTap: boolean

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

meshSelectionPredicateSearch playground for meshSelectionPredicate

meshSelectionPredicate: (mesh: AbstractMesh) => boolean

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

Type declaration

onAfterCameraTeleportSearch playground for onAfterCameraTeleport

onAfterCameraTeleport: Observable<Vector3>

Observable raised after camera teleportation

onAfterEnteringVRObservableSearch playground for onAfterEnteringVRObservable

onAfterEnteringVRObservable: Observable<OnAfterEnteringVRObservableEvent>

Observable raised when entering VR has completed.

onBeforeCameraTeleportSearch playground for onBeforeCameraTeleport

onBeforeCameraTeleport: Observable<Vector3>

Observable raised before camera teleportation

onControllerMeshLoadedObservableSearch playground for onControllerMeshLoadedObservable

onControllerMeshLoadedObservable: Observable<WebVRController>

Observable raised when controller mesh is loaded.

onEnteringVRObservableSearch playground for onEnteringVRObservable

onEnteringVRObservable: Observable<VRExperienceHelper>

Observable raised right before entering VR.

onExitingVRObservableSearch playground for onExitingVRObservable

onExitingVRObservable: Observable<VRExperienceHelper>

Observable raised when exiting VR.

onMeshSelectedWithControllerSearch playground for onMeshSelectedWithController

onMeshSelectedWithController: Observable<{ controller: WebVRController; mesh: AbstractMesh }>

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

onNewMeshPickedSearch playground for onNewMeshPicked

onNewMeshPicked: Observable<PickingInfo>

Observable raised when a new mesh is picked based on meshSelectionPredicate

onNewMeshSelectedSearch playground for onNewMeshSelected

onNewMeshSelected: Observable<AbstractMesh>

Observable raised when a new mesh is selected based on meshSelectionPredicate

onSelectedMeshUnselectedSearch playground for onSelectedMeshUnselected

onSelectedMeshUnselected: Observable<AbstractMesh>

Observable raised when current selected mesh gets unselected

raySelectionPredicateSearch playground for raySelectionPredicate

raySelectionPredicate: (mesh: AbstractMesh) => boolean

To be optionaly changed by user to define custom ray selection

Type declaration

requestPointerLockOnFullScreenSearch playground for requestPointerLockOnFullScreen

requestPointerLockOnFullScreen: boolean

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

teleportationEnabledSearch playground for teleportationEnabled

teleportationEnabled: boolean

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

updateControllerLaserColorSearch playground for updateControllerLaserColor

updateControllerLaserColor: boolean

If the controller laser color should be updated when selecting meshes

updateGazeTrackerColorSearch playground for updateGazeTrackerColor

updateGazeTrackerColor: boolean

If the gaze trackers color should be updated when selecting meshes

updateGazeTrackerScaleSearch playground for updateGazeTrackerScale

updateGazeTrackerScale: boolean

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

webVROptionsSearch playground for webVROptions

Options to modify the vr experience helper's behavior.

xrSearch playground for xr

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

xrTestDoneSearch playground for xrTestDone

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_CONSTANTSPEEDSearch playground for TELEPORTATIONMODE_CONSTANTSPEED

TELEPORTATIONMODE_CONSTANTSPEED: number

Speed Constant Teleportation Mode

Static Readonly TELEPORTATIONMODE_CONSTANTTIMESearch playground for TELEPORTATIONMODE_CONSTANTTIME

TELEPORTATIONMODE_CONSTANTTIME: number

Time Constant Teleportation Mode

Accessors

currentVRCamera

  • Based on the current WebVR support, returns the current VR camera used.

    Returns Nullable<Camera>

deviceOrientationCamera

displayGaze

  • 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

  • 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

  • get gazeTrackerMesh(): Mesh
  • set gazeTrackerMesh(value: Mesh): any
  • The mesh used to display where the user is selecting, this mesh will be cloned and set as the gazeTracker for the left and right controller when set bakeCurrentTransformIntoVertices will be called on the mesh. See https://doc.babylonjs.com/resources/baking_transformations

    Returns Mesh

  • The mesh used to display where the user is selecting, this mesh will be cloned and set as the gazeTracker for the left and right controller when set bakeCurrentTransformIntoVertices will be called on the mesh. See https://doc.babylonjs.com/resources/baking_transformations

    Parameters

    Returns any

isInVRMode

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

    Returns boolean

leftControllerGazeTrackerMesh

  • The gaze tracking mesh corresponding to the left controller

    Returns Nullable<Mesh>

onControllerMeshLoaded

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

    Returns Observable<WebVRController>

onEnteringVR

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

    Returns Observable<VRExperienceHelper>

onExitingVR

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

    Returns Observable<VRExperienceHelper>

position

  • The position of the vr experience helper.

    Returns Vector3

  • Sets the position of the vr experience helper.

    Parameters

    Returns any

rightControllerGazeTrackerMesh

  • The gaze tracking mesh corresponding to the right controller

    Returns Nullable<Mesh>

teleportationTarget

  • 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

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

    Returns Nullable<HTMLButtonElement>

vrDeviceOrientationCamera

webVRCamera

  • The webVRCamera which is used when in VR.

    Returns WebVRFreeCamera

Methods

addFloorMeshSearch playground for addFloorMesh

  • 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

changeGazeColorSearch playground for changeGazeColor

  • 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

changeLaserColorSearch playground for changeLaserColor

  • 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

disposeSearch playground for dispose

  • dispose(): void
  • Exits VR and disposes of the vr experience helper

    Returns void

enableInteractionsSearch playground for enableInteractions

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

    Returns void

enableTeleportationSearch playground for enableTeleportation

  • Enables interactions and teleportation using the VR controllers and gaze.

    Parameters

    Returns void

enterVRSearch playground for enterVR

  • 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

exitVRSearch playground for exitVR

  • exitVR(): void
  • Attempt to exit VR, or fullscreen.

    Returns void

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Gets the name of the VRExperienceHelper class

    Returns string

    "VRExperienceHelper"

removeFloorMeshSearch playground for removeFloorMesh

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

    Parameters

    • floorMesh: Mesh

      the mesh to be removed.

    Returns void

setGazeColorSearch playground for setGazeColor

  • 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

setLaserColorSearch playground for setLaserColor

  • 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

setLaserLightingStateSearch playground for setLaserLightingState

  • 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

teleportCameraSearch playground for teleportCamera

  • 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

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Static property
  • Static method