XRJointSpace
实例属性
XRJointSpace.jointName只读-
被跟踪关节的名称。有关可能的的双手关节名称,请参阅
XRHand。
示例
使用 XRJointSpace 对象
您可以通过调用 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"); // XRJointSpace
indexFingerTipJoint.jointName; // "index-finger-tip"
frame.getJointPose(indexFingerTipJoint, referenceSpace); // XRJointPose
}
}
}
规范
| 规范 |
|---|
| WebXR Hand Input 模块 - Level 1 # xrhand-interface |
浏览器兼容性
加载中…