Skip to main content
Version: Current

XR Actions

os.arSupported(): Promise<boolean>

Gets whether this device supports AR or not.

Returns a promise that resolves with a boolean indicating wether or not augmented reality is supported by the device.

Examples

Check if AR is supported:
const supported = await os.arSupported();

os.disableAR(): EnableARAction

Disables augmented reality on the device.

When disabled, @onExitAR shout is sent to all bots.

Examples

Disable AR.
os.disableAR();

os.enableAR(options?: EnableXROptions): EnableARAction

Enables augmented reality on the device. You can check for device support by calling os.arSupported().

If enabled successfully, the @onEnterAR shout is sent to all bots.

The first parameter is optional and is a EnableXROptions and is the options that should be used for the AR session.

Examples

Enable AR.
os.enableAR();
Enable AR running at half the resolution of normal.
os.enableAR({
frameBufferScaleFactor: 0.5
});

os.disableVR(): EnableVRAction

Disables virtual reality on the device.

When disabled, @onExitVR shout is sent to all bots.

Examples

Disable VR.
os.disableVR();

os.enableVR(options?: EnableXROptions): EnableVRAction

Enables virtual reality on the device. You can check for device support by calling os.vrSupported().

If enabled successfully, the @onEnterVR shout is sent to all bots.

The first parameter is optional and is a EnableXROptions and is the options that should be used for the VR session.

Examples

Enable VR.
os.enableVR();
Enable VR running at half the resolution of normal.
os.enableVR({
frameBufferScaleFactor: 0.5
});

os.vrSupported(): Promise<boolean>

Gets whether this device supports VR or not.

Returns a promise that resolves with a boolean indicating wether or not virtual reality is supported by the device.

Examples

Check if VR is supported:
const supported = await os.vrSupported();