XRJointSpace: jointName 屬性

可用性有限

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

XRJointSpace 介面的只讀 jointName 屬性包含其跟蹤的關節的名稱。

一個表示關節名稱的字串。請參閱 XRHand 頁面上的手部關節列表。

示例

獲取 jointName

給定一個 XRJointSpacejointName 屬性將包含手部關節的名稱。

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"); // XRJointSpace
      indexFingerTipJoint.jointName; // "index-finger-tip"
    }
  }
}

規範

規範
WebXR Hand Input 模組 - Level 1
# dom-xrjointspace-jointname

瀏覽器相容性

另見