XRFrame
Limited availability
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.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
A WebXR Device API XRFrame object is passed into the requestAnimationFrame() callback function and provides access to the information needed in order to render a single frame of animation for an XRSession describing a VR or AR scene. Events which communicate the tracking state of objects also provide an XRFrame reference as part of their structure.
In addition to providing a reference to the XRSession for which this frame is to be rendered, the getViewerPose() method is provided to obtain the XRViewerPose describing the viewer's position and orientation in space, and getPose() can be used to create an XRPose describing the relative position of one XRSpace relative to another.
Instance properties
sessionRead only Experimental-
The
XRSessionthat for which thisXRFramedescribes the tracking details for all objects. The information about a specific object can be obtained by calling one of the methods on the object. trackedAnchorsRead only Experimental-
An
XRAnchorSetcontaining all anchors still tracked in the frame.
Instance methods
createAnchor()Experimental-
Returns a
Promisewhich resolves to a free-floatingXRAnchorobject. fillJointRadii()Experimental-
Populates a
Float32Arraywith radii for a list of hand joint spaces. Returnstrueif successful for all spaces. fillPoses()Experimental-
Populates a
Float32Arraywith the matrices of the poses, relative to a given base space. Returnstrueif all spaces have a valid pose. getDepthInformation()Experimental-
Returns an
XRCPUDepthInformationobject containing CPU depth information for the frame. getHitTestResults()Experimental-
Returns an array of
XRHitTestResultobjects containing hit test results for a givenXRHitTestSource. getHitTestResultsForTransientInput()Experimental-
Returns an array of
XRTransientInputHitTestResultobjects containing hit test results for a givenXRTransientInputHitTestSource. getJointPose()Experimental-
Returns an
XRJointPoseobject providing the pose of a hand joint (seeXRHand) relative to a given base space. getLightEstimate()Experimental-
Returns an
XRLightEstimateobject containing estimated lighting values for anXRLightProbe. getPose()Experimental-
Returns an
XRPoseobject representing the spatial relationship between the two specifiedXRSpaceobjects. getViewerPose()Experimental-
Returns an
XRViewerPosedescribing the viewer's position and orientation in a givenXRReferenceSpace.
Specifications
| Specification |
|---|
| WebXR Device API> # xrframe-interface> |
Browser compatibility
Loading…