XRJointPose: radius 属性

可用性有限

此特性不是基线特性,因为它在一些最广泛使用的浏览器中不起作用。

XRJointPose 接口的只读 radius 属性指示了关节的半径(距皮肤的距离)。

一个表示半径(以米为单位)的数字。

示例

获取手部关节的 radius

使用 XRJointSpaceXRReferenceSpace 调用 XRFrame.getJointPose() 来获取提供 radius 属性的 XRJointPose 对象。

js
navigator.xr
  .requestSession({ optionalFeatures: ["hand-tracking"] })
  .then(/** … */);

function renderFrame(session, frame) {
  // …

  for (const inputSource of session.inputSources) {
    if (inputSource.hand) {
      const indexFingerTipJoint = inputSource.hand.get("index-finger-tip");
      const radius = frame.getJointPose(
        indexFingerTipJoint,
        referenceSpace,
      ).radius;
    }
  }
}

规范

规范
WebXR Hand Input 模块 - Level 1
# dom-xrjointpose-radius

浏览器兼容性

另见