Class VRExperienceHelper
Hierarchy
- VRExperienceHelper
Index
Constructors
Properties
- enable
Gaze Even When No Pointer Lock - exitVROn
Double Tap - mesh
Selection Predicate - on
After Camera Teleport - on
After EnteringVRObservable - on
Before Camera Teleport - on
Controller Mesh Loaded Observable - on
EnteringVRObservable - on
ExitingVRObservable - on
Mesh Selected With Controller - on
New Mesh Picked - on
New Mesh Selected - on
Selected Mesh Unselected - ray
Selection Predicate - request
Pointer Lock On Full Screen - teleportation
Enabled - update
Controller Laser Color - update
Gaze Tracker Color - update
Gaze Tracker Scale - webVROptions
- xr
- xr
Test Done - TELEPORTATIONMODE_
CONSTANTSPEED - TELEPORTATIONMODE_
CONSTANTTIME
Accessors
Methods
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
enable Gaze Even When No Pointer LockSearch playground for enableGazeEvenWhenNoPointerLock
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)
exitVROn Double TapSearch playground for exitVROnDoubleTap
Gets or sets a boolean indicating that the VREXperienceHelper will exit VR if double tap is detected
mesh Selection PredicateSearch playground for meshSelectionPredicate
Type declaration
To be optionally changed by user to define custom selection logic (after ray selection)
Parameters
mesh: AbstractMesh
Returns boolean
on After Camera TeleportSearch playground for onAfterCameraTeleport
Observable raised after camera teleportation
on After EnteringVRObservableSearch playground for onAfterEnteringVRObservable
Observable raised when entering VR has completed.
on Before Camera TeleportSearch playground for onBeforeCameraTeleport
Observable raised before camera teleportation
on Controller Mesh Loaded ObservableSearch playground for onControllerMeshLoadedObservable
Observable raised when controller mesh is loaded.
on EnteringVRObservableSearch playground for onEnteringVRObservable
Observable raised right before entering VR.
on ExitingVRObservableSearch playground for onExitingVRObservable
Observable raised when exiting VR.
on Mesh Selected With ControllerSearch playground for onMeshSelectedWithController
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
on New Mesh PickedSearch playground for onNewMeshPicked
Observable raised when a new mesh is picked based on meshSelectionPredicate
on New Mesh SelectedSearch playground for onNewMeshSelected
Observable raised when a new mesh is selected based on meshSelectionPredicate
on Selected Mesh UnselectedSearch playground for onSelectedMeshUnselected
Observable raised when current selected mesh gets unselected
ray Selection PredicateSearch playground for raySelectionPredicate
Type declaration
To be optionally changed by user to define custom ray selection
Parameters
mesh: AbstractMesh
Returns boolean
request Pointer Lock On Full ScreenSearch playground for requestPointerLockOnFullScreen
Defines whether or not Pointer lock should be requested when switching to full screen.
teleportation EnabledSearch playground for teleportationEnabled
Set teleportation enabled. If set to false camera teleportation will be disabled but camera rotation will be kept.
update Controller Laser ColorSearch playground for updateControllerLaserColor
If the controller laser color should be updated when selecting meshes
update Gaze Tracker ColorSearch playground for updateGazeTrackerColor
If the gaze trackers color should be updated when selecting meshes
update Gaze Tracker ScaleSearch playground for updateGazeTrackerScale
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
xr Test DoneSearch playground for xrTestDone
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
Speed Constant Teleportation Mode
Static Readonly TELEPORTATIONMODE_ CONSTANTTIMESearch playground for TELEPORTATIONMODE_CONSTANTTIME
Time Constant Teleportation Mode
Accessors
currentVRCamera
device Orientation Camera
The deviceOrientationCamera used as the camera when not in VR.
Returns Nullable<DeviceOrientationCamera>
display Gaze
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
display Laser Pointer
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
gaze Tracker 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
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
value: Mesh
Returns void
is InVRMode
Gets a value indicating if we are currently in VR mode.
Returns boolean
left Controller Gaze Tracker Mesh
on Controller Mesh Loaded
Return this.onControllerMeshLoadedObservable Note: This one is for backward compatibility. Please use onControllerMeshLoadedObservable directly
Returns Observable<WebVRController>
on EnteringVR
Return this.onEnteringVRObservable Note: This one is for backward compatibility. Please use onEnteringVRObservable directly
Returns Observable<VRExperienceHelper>
on ExitingVR
Return this.onExitingVRObservable Note: This one is for backward compatibility. Please use onExitingVRObservable directly
Returns Observable<VRExperienceHelper>
position
right Controller Gaze Tracker Mesh
teleportation Target
vr Button
The html button that is used to trigger entering into VR.
Returns Nullable<HTMLButtonElement>
vr Device Orientation Camera
The deviceOrientationCamera that is used as a fallback when vr device is not connected.
Returns Nullable<VRDeviceOrientationFreeCamera>
webVRCamera
The webVRCamera which is used when in VR.
Returns WebVRFreeCamera
Methods
add Floor MeshSearch playground for addFloorMesh
Adds a floor mesh to be used for teleportation.
Parameters
floorMesh: Mesh
the mesh to be used for teleportation.
Returns void
change Gaze ColorSearch playground for changeGazeColor
Sets the color of the ray from the vr headsets gaze.
Parameters
color: Color3
new color for the ray.
Returns void
change Laser ColorSearch playground for changeLaserColor
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
Exits VR and disposes of the vr experience helper
Returns void
enable InteractionsSearch playground for enableInteractions
Enables controllers and user interactions such as selecting and object or clicking on an object.
Returns void
enable TeleportationSearch playground for enableTeleportation
Enables interactions and teleportation using the VR controllers and gaze.
Parameters
Optional vrTeleportationOptions: VRTeleportationOptions
options to modify teleportation behavior.
Returns void
enterVRSearch playground for enterVR
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
Attempt to exit VR, or fullscreen.
Returns void
get Class NameSearch playground for getClassName
Gets the name of the VRExperienceHelper class
Returns string
"VRExperienceHelper"
remove Floor MeshSearch playground for removeFloorMesh
Removes a floor mesh from being used for teleportation.
Parameters
floorMesh: Mesh
the mesh to be removed.
Returns void
set Gaze ColorSearch playground for setGazeColor
set Laser ColorSearch playground for setLaserColor
set Laser Lighting StateSearch playground for setLaserLightingState
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
teleport CameraSearch playground for teleportCamera
Teleports the users feet to the desired location
Parameters
location: Vector3
The location where the user's feet should be placed
Returns void
Helps to quickly add VR support to an existing scene. See https://doc.babylonjs.com/divingDeeper/cameras/webVRHelper