XRJointPose

可用性有限

此特性不是基線特性,因為它在一些最廣泛使用的瀏覽器中不起作用。

XRJointPose 介面是 XRPose 介面的擴充套件,它包含了表示骨骼關節大小的額外資訊。

XRPose XRJointPose

例項屬性

XRJointPose.radius 只讀

關節的半徑(與皮膚的距離)。

示例

使用 XRJointPose 物件

呼叫 XRFrame.getJointPose(),傳入一個 XRJointSpace 和一個 XRReferenceSpace 來獲取一個 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");
      frame.getJointPose(indexFingerTipJoint, referenceSpace); // XRJointPose
    }
  }
}

規範

規範
WebXR Hand Input 模組 - Level 1
# xrjointpose-interface

瀏覽器相容性

另見