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

浏览器兼容性

另见