XRHitTestResult: phương thức getPose()
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Phương thức getPose() của giao diện XRHitTestResult trả về XRPose của kết quả kiểm tra va chạm tương đối với không gian cơ sở cho trước.
Cú pháp
js
getPose(baseSpace)
Tham số
Giá trị trả về
Trả về một đối tượng XRPose.
Ví dụ
>Lấy tư thế của kết quả kiểm tra va chạm
Ví dụ sau sử dụng getPose() để truy vấn tư thế của một kết quả kiểm tra va chạm duy nhất.
js
let hitTestResults = xrFrame.getHitTestResults(hitTestSource);
if (hitTestResults.length > 0) {
let pose = hitTestResults[0].getPose(referenceSpace);
}
Thông số kỹ thuật
| Specification |
|---|
| WebXR Hit Test Module> # dom-xrhittestresult-getpose> |