XRSession.requestReferenceSpace()

Draft
This page is not complete.

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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

The requestReferenceSpace() method of the XRSession interface returns a Promise that resolves with either an instance of XRReferenceSpace or of XRBoundedReferenceSpace which contains information about the current session tracking behavior.

Syntax

var promise = XRSession.requestReferenceSpace(type);

Parameters

type
Specifies the desired type of XRReferenceSpace. Valid values are:
  • "viewer": Creates an XRReferenceSpace tracking space with a native origin that tracks the position and orientation of the viewer. Every XRSession object supports this type.
  • "local": Creates an XRReferenceSpace tracking space with a native origin that tracks the approximate location of the viewer's head at the time of creation where the user is expected to move very little or not at all.. The exact position and orientation are based on the conventions of the underlying platform. 
  • "local-floor": Creates an XRReferenceSpace tracking space with a native origin at the floor where the user is expected to move very little or not at all. For this type, the y axis will be 0 at floor level. The position and orientation of the x and z axes will be based on the conventions of the the unerlying platform. If the floor level isn't known, it will be estimated. If the floor level isn't known, it will be estimated with rounded values to prevent fingerprinting. 
  • "bounded-floor": Creates an XRBoundedReferenceSpace tracking space with a native origin at the floor where the user is expected to move within a pre-established boundary, which may be retrieved with XRBoundedReferenceSpace.boundsGeometry
  • "unbounded": Creates an XRReferenceSpace tracking space where the user is expected to move freely around their environment, pontentially even long distances from their starting point. Because tracking is optimized for stability around the user's current position, the native orign may drift.

Return value

A Promise that resolves with an XRReferenceSpace object.

Exceptions

NotSupportedError
thrown when the requested reference space type is not supported.

Specifications

Specification Status Comment
WebXR Device API
The definition of 'requestReferenceSpace' 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
requestReferenceSpace()Chrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No

Legend

No support  
No support

Document Tags and Contributors

Contributors to this page: ExE-Boss, jpmedley
Last updated by: ExE-Boss,