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

瀏覽器相容性

另見