XRReferenceSpace

Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Draft
This page is not complete.

The WebXR Device API's XRReferenceSpace interface describes the coordinate system for a specific tracked entity or object within the virtual world using a specified tracking behavior. It expands upon the base class, XRSpace, by adding support for several different tracking behaviors as well as to request a new reference space which describes the offset transform between the tracked object and another location in the world.

<<<<---- NEED ADDITIONAL INFORMATION ABOUT REFERENCE SPACES ---->>>>

Properties

In addition to the properties inherited from XRSpace (of which there are none at this time), XRReferenceSpace also inherits the properties of EventTargetXRReferenceSpace defines no additional properties

Methods

In addition to the methods inherited from its parent interface, XRSpace (there are none at this time), XRReferenceSpace inherits methods from  EventTargetXRReferenceSpace also provides the following methods.

getOffsetReferenceSpace() 
Creates and returns a new reference space object as the same type as the one on which you call the method (so, either XRReferenceSpace or XRBoundedReferenceSpace). The new reference space can be used to transform a coordinate from the reference space of the object on which the method is called into a different coordinate space. This is useful for positioning objects while rendering, and to perform the needed transforms when changing the viewer's position and/or orientation in 3D space.

Events

In addition to other events that may be sent to XRSpace or EventTarget objects, the following also apply to XRReferenceSpace objects.

reset

The reset event is sent to an XRReferenceSpace object when the browser detects a discontinuity has occurred wherein the tracked object's origin  relative to the user's environment or location. This can happen, for example, after the user recalibrates their XR device, or if the device automatically adjusts its origin after losing and regaining tracking.

In addition to using addEventListener(), you can establish a reset event handler by setting the onreset event handler property.

Usage notes

The native origin of any XRReferenceSpace is always configured so that +X is considered to be to the right, +Y is upward, and +Z is "forward" or into the screen from the user's seat.

Specifications

Specification Status Comment
WebXR Device API
The definition of 'XRReferenceSpace' in that specification.
Working Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
XRReferenceSpaceChrome Full support 79Edge No support NoFirefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android Full support 79Firefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
getOffsetReferenceSpace()Chrome Full support 79Edge No support NoFirefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android Full support 79Firefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
onresetChrome Full support 79Edge No support NoFirefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android Full support 79Firefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
reset eventChrome Full support 79Edge No support NoFirefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android Full support 79Firefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support