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).
For more information with regard to supported VR devices and best practices see the corresponding topic of this User Manual.
- Puzzles Reference
check VR mode
Checks 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.
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.
- room - mobile camera located inside some bounds such as room (e.g. for HTC Vive).
- looking around - immobile camera positioned at zero coordinates.
- walking - mobile unbounded camera.
- viewer locked - immobile camera positioned at zero coordinates. All content is parented to the view.
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.
check AR mode
Checks the augmented reality system. If successful, the puzzles in the if available do are triggered. Otherwise, if the browser does not support AR or AR hardware not found, the puzzles in the if unavailable do slot are triggered.
enter AR mode
Enters the augmented reality mode. Puzzles placed in the on enter do and on exit do slots are triggered upon entering or exiting the AR mode. Puzzles placed in the if unavailable do are triggered if a AR session could not be established.
detect horizontal surface AR
Detect horizontal surfaces in AR mode by casting a ray forward. Upon intersection, this ray will trigger puzzles in on intersection do slot. If no intersection occurred or the device is in warming-up state the puzzles triggers if missed do slot.
AR hit point
Surface hit point coordinates.
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.
- select - triggered when user pressed and released the primary controller button.
- selectstart - triggered when user pressed the primary controller button.
- selectend - triggered when user released the primary controller button.
- squeeze - triggered when user squeezed and released a controller.
- squeezestart - triggered when user squeezed a controller.
- squeezeend - triggered when user unsqueezed controller.
- connected - triggered when VR controller connected, i.e. upon entering a VR session. Use this event to initialize any controller logic.
- disconnected - triggered when VR controller disconnected.
Loop over all connected VR controllers, execute puzzles specified in the do slot.
get controller property
Get the controller property.
- object - an empty object representing controller.
- ray/reticle - controller ray or reticle object.
- handedness - controller handedness, one of: "left" (left controller), "right" (right controller), "none" (unspecified, likely head-mounted controller).
- target ray mode - one of: "gaze" (for gaze aka cardboard-like devices), "tracked-pointer" (for regular handheld controllers), "screen" (the event is associated with canvas input, currently not implemented).
- profiles - a list of controller profile names.
- gamepad index - a controller gamepad index which can be passed to the get gamepad property puzzle to retrieve more info from your controller, such as the status of buttons/axes.
Having Troubles with Puzzles?
Seek help on the forums!