XRJointPose: radius 属性
XRJointPose 接口的只读 radius 属性指示了关节的半径(距皮肤的距离)。
值
一个表示半径(以米为单位)的数字。
示例
获取手部关节的 radius
使用 XRJointSpace 和 XRReferenceSpace 调用 XRFrame.getJointPose() 来获取提供 radius 属性的 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");
const radius = frame.getJointPose(
indexFingerTipJoint,
referenceSpace,
).radius;
}
}
}
规范
| 规范 |
|---|
| WebXR Hand Input 模块 - Level 1 # dom-xrjointpose-radius |
浏览器兼容性
加载中…