Options
All
  • Public
  • Public/Protected
  • All
Menu

Helps to quickly add VR support to an existing scene. See https://doc.babylonjs.com/divingDeeper/cameras/webVRHelper

deprecated

Hierarchy

  • VRExperienceHelper

Index

Constructors

  • 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: 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: boolean

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

meshSelectionPredicate: (mesh: AbstractMesh) => boolean

Type declaration

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

      Parameters

      Returns boolean

onAfterCameraTeleport: Observable<Vector3>

Observable raised after camera teleportation

onAfterEnteringVRObservable: Observable<OnAfterEnteringVRObservableEvent>

Observable raised when entering VR has completed.

onBeforeCameraTeleport: Observable<Vector3>

Observable raised before camera teleportation

onControllerMeshLoadedObservable: Observable<WebVRController>

Observable raised when controller mesh is loaded.

onEnteringVRObservable: Observable<VRExperienceHelper>

Observable raised right before entering VR.

onExitingVRObservable: Observable<VRExperienceHelper>

Observable raised when exiting VR.

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

onNewMeshPicked: Observable<PickingInfo>

Observable raised when a new mesh is picked based on meshSelectionPredicate

onNewMeshSelected: Observable<AbstractMesh>

Observable raised when a new mesh is selected based on meshSelectionPredicate

onSelectedMeshUnselected: Observable<AbstractMesh>

Observable raised when current selected mesh gets unselected

raySelectionPredicate: (mesh: AbstractMesh) => boolean

Type declaration

    • To be optionally changed by user to define custom ray selection

      Parameters

      Returns boolean

requestPointerLockOnFullScreen: boolean

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

teleportationEnabled: boolean

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

updateControllerLaserColor: boolean

If the controller laser color should be updated when selecting meshes

updateGazeTrackerColor: boolean

If the gaze trackers color should be updated when selecting meshes

updateGazeTrackerScale: boolean

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

Options to modify the vr experience helper's behavior.

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

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.

TELEPORTATIONMODE_CONSTANTSPEED: 1 = 1

Speed Constant Teleportation Mode

TELEPORTATIONMODE_CONSTANTTIME: 0 = 0

Time Constant Teleportation Mode

Accessors

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

    Returns Nullable<Camera>

  • get displayGaze(): boolean
  • set displayGaze(value: boolean): void
  • 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 void

  • get displayLaserPointer(): boolean
  • set displayLaserPointer(value: boolean): void
  • 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 void

  • get gazeTrackerMesh(): Mesh
  • set gazeTrackerMesh(value: Mesh): void
  • 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 void

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

    Returns boolean

  • The gaze tracking mesh corresponding to the left controller

    Returns Nullable<Mesh>

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

    Returns Observable<WebVRController>

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

    Returns Observable<VRExperienceHelper>

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

    Returns Observable<VRExperienceHelper>

  • The position of the vr experience helper.

    Returns Vector3

  • Sets the position of the vr experience helper.

    Parameters

    Returns void

  • The gaze tracking mesh corresponding to the right controller

    Returns Nullable<Mesh>

  • get teleportationTarget(): Mesh
  • set teleportationTarget(value: Mesh): void
  • 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 void

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

    Returns Nullable<HTMLButtonElement>

  • The webVRCamera which is used when in VR.

    Returns WebVRFreeCamera

Methods

  • 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(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(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(): void
  • Exits VR and disposes of the vr experience helper

    Returns void

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

    Returns void

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

    Parameters

    Returns void

  • 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(): void
  • Attempt to exit VR, or fullscreen.

    Returns void

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

    Returns string

    "VRExperienceHelper"

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

    Parameters

    • floorMesh: Mesh

      the mesh to be removed.

    Returns void

  • 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

  • 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(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(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
  • Inherited constructor

Settings

Theme