XRFrame: phương thức fillPoses()

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 fillPoses() của giao diện XRFrame điền một Float32Array với các ma trận tư thế tương đối với không gian cơ sở cho trước và trả về true nếu thành công cho tất cả các không gian.

Cú pháp

js
fillPoses(spaces, baseSpace, transforms)

Tham số

spaces

Một mảng các đối tượng XRSpace để lấy tư thế.

baseSpace

Một đối tượng XRSpace được dùng làm cơ sở hoặc gốc tọa độ cho vị trí và hướng tương đối.

transforms

Một Float32Array được điền với các ma trận tư thế tương đối với baseSpace cho trước.

Giá trị trả về

Một giá trị boolean cho biết liệu tất cả các không gian có tư thế hợp lệ hay không.

Ngoại lệ

TypeError

Được ném nếu độ dài của spaces nhân với 16 lớn hơn số phần tử trong transforms.

Ví dụ

Lấy tư thế cho tất cả khớp của một bàn tay

Để hiệu quả lấy tất cả tư thế cho 25 khớp của mỗi XRHand, bạn có thể sử dụng phương thức fillPoses().

js
let poses1 = new Float32Array(16 * 25);
let poses2 = new Float32Array(16 * 25);

function onXRFrame(xrFrame, renderer) {
  let hand1 = xrFrame.session.inputSources[0].hand;
  xrFrame.fillPoses(hand1.values(), renderer.referenceSpace, poses1);
  let hand2 = xrFrame.session.inputSources[1].hand;
  xrFrame.fillPoses(hand2.values(), renderer.referenceSpace, poses2);
}

Thông số kỹ thuật

Specification
WebXR Hand Input Module - Level 1
# dom-xrframe-fillposes

Tương thích trình duyệt

Xem thêm