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 |
瀏覽器相容性
載入中…