These puzzles are used to enable web-based Augmented Reality (AR) and Virtual Reality (VR) experiences running on top of the in-development browser technology called WebXR (eXtended Reality on the Web).
These puzzles are considered experimental as WebXR is undergoing rapid development, with browser preview builds changing on daily basis. At the moment the AR puzzles are disabled until the specification is stabilized. In order to use the VR puzzles, we recommend to turn on the Legacy VR checkbox when creating a new project.
"init VR mode"
Initializes the virtual reality system. If successful, the puzzles in the "if available do" are triggered. Otherwise, if the browser does not support VR or VR hardware not found, the puzzles in the "if unavailable do" slot are triggered.
For more information with regard to supported VR devices and best practices see the User Manual.
"enter VR mode"
Enters the virtual reality mode. Puzzles placed in the on enter do and on exit do slots are triggered upon entering or exiting the VR mode. Puzzles placed in the if unavailable do are triggered if a VR session could not be established.
VR camera modes:
- sitting or standing - immobile camera positioned at some height above the ground
- walking - mobile camera (e.g. for HTC Vive)
- looking from origin - immobile camera positioned at zero coordinates
Due to gaps in browsers' WebXR implementation, the "sitting or standing" mode works as "looking from origin" at the moment.
The numeric parameter hover to click after denotes the period of time (in seconds) for an object, over which the VR reticle is hovered, to receive a mouse click event. Default Infinity means no hover-to-click conversion.
In order to properly control the camera in VR mode, be sure to snap and parent it to some empty/dummy or real object, positioned in the 3D editor of your choice, upon entering the VR mode. This is needed because the VR session has the full control over your camera, and you can move only the empty/dummy object to which the camera is parented.
"end VR session"
Ends a virtual reality session.
"on session event"
Captures a VR session event generated by a VR device (e.g. a headset or controller button) and triggers puzzles specified in the do slot.
We recommend to provide a fallback for devices not supporting WebXR. For example, the following snippet will work for Google Cardboard v2 with an Android/iOS smartphone inserted.