大网数据广告活动
Web 标准与前端开发

XRFrame

· 52CE 我爱测

A WebXR Device API **`XRFrame`** object is passed into the XRSession.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 tra

WebXR Device API

A WebXR Device API XRFrame object is passed into the XRSession.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 XRFrame.getViewerPose method is provided to obtain the XRViewerPose describing the viewer's position and orientation in space, and XRFrame.getPose can be used to create an XRPose describing the relative position of one XRSpace relative to another.

Instance properties

  • XRFrame.session
    • : The XRSession that for which this XRFrame describes the tracking details for all objects. The information about a specific object can be obtained by calling one of the methods on the object.
  • XRFrame.trackedAnchors
    • : An XRAnchorSet containing all anchors still tracked in the frame.

Instance methods

  • XRFrame.createAnchor()
    • : Returns a Promise which resolves to a free-floating XRAnchor object.
  • XRFrame.fillJointRadii()
    • : Populates a Float32Array with radii for a list of hand joint spaces. Returns true if successful for all spaces.
  • XRFrame.fillPoses()
    • : Populates a Float32Array with the matrices of the poses, relative to a given base space. Returns true if all spaces have a valid pose.
  • XRFrame.getDepthInformation()
    • : Returns an XRCPUDepthInformation object containing CPU depth information for the frame.
  • XRFrame.getHitTestResults()
    • : Returns an array of XRHitTestResult objects containing hit test results for a given XRHitTestSource.
  • XRFrame.getHitTestResultsForTransientInput()
    • : Returns an array of XRTransientInputHitTestResult objects containing hit test results for a given XRTransientInputHitTestSource.
  • XRFrame.getJointPose()
    • : Returns an XRJointPose object providing the pose of a hand joint (see XRHand) relative to a given base space.
  • XRFrame.getLightEstimate()
    • : Returns an XRLightEstimate object containing estimated lighting values for an XRLightProbe.
  • XRFrame.getPose
    • : Returns an XRPose object representing the spatial relationship between the two specified XRSpace objects.
  • XRFrame.getViewerPose
    • : Returns an XRViewerPose describing the viewer's position and orientation in a given XRReferenceSpace.

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。