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.
Thuộc tính phiên bản
XRJointSpace.jointNameRead 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> |