XRJointSpace

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Giao diện XRJointSpace là một XRSpace đại diện cho vị trí và hướng của một khớp XRHand.

EventTarget XRSpace XRJointSpace

Thuộc tính phiên bản

XRJointSpace.jointName Read only

Tên của khớp được theo dõi. Xem XRHand để biết các tên khớp bàn tay có thể có.

Ví dụ

Sử dụng các đối tượng XRJointSpace

Bạn có thể dùng đối tượng XRJointSpace cùng với XRReferenceSpace để lấy XRJointPose bằng cách gọi XRFrame.getJointPose().

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"
      frame.getJointPose(indexFingerTipJoint, referenceSpace); // XRJointPose
    }
  }
}

Thông số kỹ thuật

Specification
WebXR Hand Input Module - Level 1
# xrhand-interface

Tương thích trình duyệt

Xem thêm