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 insecure contexts (HTTPS), in some or allsupporting browsers.
Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.
AWebXR Device APIXRFrame object is passed into therequestAnimationFrame() callback function and provides access to the information needed in order to render a single frame of animation for anXRSession describing a VR or AR scene. Events which communicate the tracking state of objects also provide anXRFrame reference as part of their structure.
In addition to providing a reference to theXRSession for which this frame is to be rendered, thegetViewerPose() method is provided to obtain theXRViewerPose describing the viewer's position and orientation in space, andgetPose() can be used to create anXRPose describing the relative position of oneXRSpace relative to another.
In this article
Instance properties
sessionRead onlyExperimentalThe
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 onlyExperimentalAn
XRAnchorSetcontaining all anchors still tracked in the frame.
Instance methods
createAnchor()ExperimentalReturns a
Promisewhich resolves to a free-floatingXRAnchorobject.fillJointRadii()ExperimentalPopulates a
Float32Arraywith radii for a list of hand joint spaces. Returnstrueif successful for all spaces.fillPoses()ExperimentalPopulates a
Float32Arraywith the matrices of the poses, relative to a given base space. Returnstrueif all spaces have a valid pose.getDepthInformation()ExperimentalReturns an
XRCPUDepthInformationobject containing CPU depth information for the frame.getHitTestResults()ExperimentalReturns an array of
XRHitTestResultobjects containing hit test results for a givenXRHitTestSource.getHitTestResultsForTransientInput()ExperimentalReturns an array of
XRTransientInputHitTestResultobjects containing hit test results for a givenXRTransientInputHitTestSource.getJointPose()ExperimentalReturns an
XRJointPoseobject providing the pose of a hand joint (seeXRHand) relative to a given base space.getLightEstimate()ExperimentalReturns an
XRLightEstimateobject containing estimated lighting values for anXRLightProbe.getPose()ExperimentalReturns an
XRPoseobject representing the spatial relationship between the two specifiedXRSpaceobjects.getViewerPose()ExperimentalReturns an
XRViewerPosedescribing the viewer's position and orientation in a givenXRReferenceSpace.
Specifications
| Specification |
|---|
| WebXR Device API> # xrframe-interface> |