This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The XRRigidTransform is a WebXR API interface that represents the 3D geometric transform described by a position and orientation.
XRRigidTransform is used to specify transforms throughout the WebXR APIs, including:
getOffsetReferenceSpace().transform of an XRView.transform of an XRPose.XRReferenceSpaceEvent event's transform property, as found in the reset event received by an XRReferenceSpace.Using XRRigidTransform in these places rather than bare arrays that provide the matrix data has an advantage. It automatically computes the inverse of the transform and even caches it making subsequent requests significantly faster.
XRRigidTransform()Creates a new XRRigidTransform object which represents a transform that applies a specified position and/or orientation.
XRRigidTransform.position Read only
A DOMPointReadOnly specifying a 3-dimensional point, expressed in meters, describing the translation component of the transform. The w property is always 1.0.
XRRigidTransform.orientation Read only
A DOMPointReadOnly which contains a unit quaternion describing the rotational component of the transform. As a unit quaternion, its length is always normalized to 1.0.
XRRigidTransform.matrix Read only
Returns the transform matrix in the form of a 16-member Float32Array. See the section Matrix format for how the array is used to represent a matrix.
XRRigidTransform.inverse Read only
Returns a XRRigidTransform which is the inverse of this transform. That is, if applied to an object that had been previously transformed by the original transform, it will undo the transform and return the original object.
When an XRRigidTransform is interpreted, the orientation is always applied to the affected object before the position is applied.
This code snippet creates an XRRigidTransform to specify the offset and orientation in relation to the current reference space to use when creating a new reference space. It then requests the first animation frame callback by calling the session's requestAnimationFrame() method.
xrSession.requestReferenceSpace(refSpaceType).then((refSpace) => {
xrReferenceSpace = refSpace;
xrReferenceSpace = xrReferenceSpace.getOffsetReferenceSpace(
new XRRigidTransform(viewerStartPosition, cubeOrientation),
);
animationFrameRequestID = xrSession.requestAnimationFrame(drawFrame);
});
| Specification |
|---|
| WebXR Device API> # xrrigidtransform-interface> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
XRRigidTransform |
79 | 79 | No | 66 | No | 79 | No | 57 | No | 11.2 | No | No |
XRRigidTransform |
79 | 79 | No | 66 | No | 79 | No | 57 | No | 11.2 | No | No |
inverse |
79 | 79 | No | 66 | No | 79 | No | 57 | No | 11.2 | No | No |
matrix |
79 | 79 | No | 66 | No | 79 | No | 57 | No | 11.2 | No | No |
orientation |
79 | 79 | No | 66 | No | 79 | No | 57 | No | 11.2 | No | No |
position |
79 | 79 | No | 66 | No | 79 | No | 57 | No | 11.2 | No | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/XRRigidTransform