VRHandler Class
VR class handles all the virtual reality related tasks.
Can be used to detect if the host system is capable of displaying VR content and checks for the availability of WebXR and/or WebVR.
Item Index
Attributes
Methods
enterVR
-
renderer
-
onSuccess
Enter virtual reality mode using WebXR or WebVR depending on the API available.
If booth API are available the WebXR API is used.
When displaying VR content the display.requestAnimationFrame should be used to call the render method.
Parameters:
-
renderer
WebGLRendererRenderer used to draw the scene.
-
onSuccess
FunctionMethod called if the application entered VR successfully.
exitVR
-
renderer
Enter virtual reality mode, if the application is not running on VR mode does not do anything.
Parameters:
-
renderer
WebGLRendererRenderer used to draw the scene.
getVRDisplays
()
Promise
Used to get the first VR display available, the display is returned as argument of the onDisplay function.
Returns:
Promise used to get the display, receives the display as argument.
getXRSession
()
Promise
Get WebXR session.
Returns:
Promise used to get the XR session, receives the session as argument.
vrAvailable
()
Boolean
Check if there is any VR API available, on the device.
Checks if there is support for WebVR or WebXR.
Returns:
True if the browser supports vr.