Provides access to Anchors.
Provides access to DOM overlay capabilities.
Provides the ability to perform hit tests on the representation of real world geometry of the underlying AR system.
Provides access to image tracking capabilities.
Provides access to Input Sources.
Provides access to light estimation capabilities.
Provides access to mesh detection capabilities.
Provides access to plane detection capabilities.
Provides access to views and their capabilities.
True if XR session is running.
Current fixed foveation level, which is between 0 and 1. 0 - no forveation, and 1 - highest foveation. If fixed foveation is not supported, this value returns null.
Set fixed foveation to the value between 0 and 1. Where 0 - no foveation, and 1 - highest foveation. It only can be set during an active XR session. Fixed foveation will reduce the resolution of the back buffer at the edges of the sceen, which can improve rendering performance.
Framebuffer scale factor. This value is read-only and can only be set when starting a new XR session.
XR session frameRate or null if this information is not available. This value can change during an active XR session.
Provides access to XRSession of WebXR.
Returns reference space type of currently running XR session or null if no session is running. Can be any of XRSPACE_*.
True if XR is supported.
List of supported frame rates, or null if this data is not available.
Returns type of currently running XR session or null if no session is running. Can be any of XRTYPE_*.
Attempts to end XR session and optionally fires callback when session is ended or failed to end.
Optional
callback: XrErrorCallbackOptional callback function called once session is started. The callback has one argument Error - it is null if successfully started XR session.
Fire an event, all additional arguments are passed on to the event listener.
Name of event to fire.
Optional
arg1: anyFirst argument that is passed to the event handler.
Optional
arg2: anySecond argument that is passed to the event handler.
Optional
arg3: anyThird argument that is passed to the event handler.
Optional
arg4: anyFourth argument that is passed to the event handler.
Optional
arg5: anyFifth argument that is passed to the event handler.
Optional
arg6: anySixth argument that is passed to the event handler.
Optional
arg7: anySeventh argument that is passed to the event handler.
Optional
arg8: anyEighth argument that is passed to the event handler.
Self for chaining.
Initiate manual room capture. If the underlying XR system supports manual capture of the room, it will start the capturing process, which can affect plane and mesh detection, and improve hit-test quality against real-world geometry.
Callback that will be fired once capture is complete or failed.
Check if specific type of session is available.
Session type. Can be one of the following:
True if specified session type is available.
Detach an event handler from an event. If callback is not provided then all callbacks are unbound from the event, if scope is not provided then all events with the callback will be unbound.
Optional
name: stringName of the event to unbind.
Optional
callback: HandleEventCallbackFunction to be unbound.
Optional
scope: objectScope that was used as the this when the event is fired.
Self for chaining.
const handler = function () {
};
obj.on('test', handler);
obj.off(); // Removes all events
obj.off('test'); // Removes all events called 'test'
obj.off('test', handler); // Removes all handler functions, called 'test'
obj.off('test', handler, this); // Removes all handler functions, called 'test' with scope this
Attach an event handler to an event.
Name of the event to bind the callback to.
Function that is called when event is fired. Note the callback is limited to 8 arguments.
Optional
scope: object = ...Object to use as 'this' when the event is fired, defaults to current this.
Can be used for removing event in the future.
Attach an event handler to an event. This handler will be removed after being fired once.
Name of the event to bind the callback to.
Function that is called when event is fired. Note the callback is limited to 8 arguments.
Optional
scope: object = ...Object to use as 'this' when the event is fired, defaults to current this.
Attempts to start XR session for provided CameraComponent and optionally fires callback when session is created or failed to create. Integrated XR APIs need to be enabled by providing relevant options.
It will be used to render XR session and manipulated based on pose tracking.
Session type. Can be one of the following:
Reference space type. Can be one of the following:
Optional
options: { Object with additional options for XR session initialization.
Set to true to attempt to enable XrAnchors.
Optional callback function called once session is started. The callback has one argument Error - it is null if successfully started XR session.
Optional object with depth sensing parameters to attempt to enable XrDepthSensing.
Framebuffer scale factor should be higher than 0.0, by default 1.0 (no scaling). A value of 0.5 will reduce the resolution of an XR session in half, and a value of 2.0 will double the resolution.
Set to true to attempt to enable XrImageTracking.
Set to true to attempt to enable XrMeshDetection.
Optional features for XRSession start. It is used for getting access to additional WebXR spec extensions.
Set to true to attempt to enable XrPlaneDetection.
Update target frame rate of an XR session to one of supported value provided by supportedFrameRates list.
Target frame rate. It should be any value from the list of supportedFrameRates.
Optional
callback: FunctionCallback that will be called when frameRate has been updated or failed to update with error provided.
Static
EVENT_Fired when availability of the XR type is changed. This event is available in two forms. They are as follows:
available
- Fired when availability of any XR type is changed. The handler is passed
the session type that has changed availability and a boolean representing the availability.available:[type]
- Fired when availability of specific XR type is changed. The handler
is passed a boolean representing the availability.Static
EVENT_Fired when XR session is ended.
Static
EVENT_Fired when XR session is failed to start or failed to check for session type support. The handler is passed the Error object related to failure of session start or check of session type support.
Static
EVENT_Fired when XR session is started.
Static
EVENT_Fired when XR session is updated, providing relevant XRFrame object. The handler is passed XRFrame object that can be used for interfacing directly with WebXR APIs.
Manage and update XR session and its states.