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 read-only XRInputSource property gripSpace returns an XRSpace whose native origin tracks the pose used to render virtual objects so they appear to be held in (or part of) the user's hand. For example, if a user were holding a virtual straight rod, the native origin of this XRSpace would be located at the approximate center of mass of the user's fist.
An XRSpace object representing the position and orientation of the input device in virtual space, suitable for rendering an image of the device into the scene. gripSpace is null if the input source is not inherently trackable. For example, only inputs whose targetRayMode is tracked-pointer provide a gripSpace.
Imagine that the controller is shaped like a straight rod, held in the user's fist. The native origin of the grip space is located at the centroid—the center of mass—of the user's fist, tracking the position of the user's hand.
The coordinate system for the left hand's grip space.
The coordinate system for the right hand's grip space.
As shown in the diagram above, the coordinate system is oriented as follows:
In tis example, taken from the frame rendering callback, the gripSpace is used to render a mesh that represents the position and orientation of the controller in the virtual environment.
for (const source in xrSession.inputSources) {
if (source.gripSpace) {
const gripPose = frame.getPose(source.gripSpace, xrRefSpace);
if (gripPose) {
myDrawMeshUsingTransform(controllerMesh, gripPose.transform.matrix);
}
}
}
For each input source which has a value for gripSpace, this loop obtains the XRPose representing the position and orientation that are described by gripSpace. If a valid pose is returned, a method myDrawMeshUsingTransform() is called to draw the controller's mesh transformed using the grip pose's transform matrix.
| Specification |
|---|
| WebXR Device API> # dom-xrinputsource-gripspace> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
gripSpace |
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/XRInputSource/gripSpace