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

Khả dụng hạn chế

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 fillJointRadii() của giao diện XRFrame điền một Float32Array với bán kính cho danh sách các không gian khớp tay và trả về true nếu thành công cho tất cả các không gian.

Cú pháp

js
fillJointRadii(jointSpaces, radii)

Tham số

jointSpaces

Một mảng các đối tượng XRJointSpace để lấy bán kính.

radii

Một Float32Array được điền với bán kính của các jointSpaces.

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 jointSpaces lớn hơn số phần tử trong radii.

Ví dụ

Lấy bán kính cho tất cả khớp của một bàn tay

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

js
let radii1 = new Float32Array(25);
let radii2 = new Float32Array(25);

function onXRFrame(xrFrame, renderer) {
  let hand1 = xrFrame.session.inputSources[0].hand;
  xrFrame.fillJointRadii(hand1.values(), radii1);
  let hand2 = xrFrame.session.inputSources[1].hand;
  xrFrame.fillJointRadii(hand2.values(), radii2);
}

Thông số kỹ thuật

Thông số kỹ thuật
WebXR Hand Input Module - Level 1
# dom-xrframe-filljointradii

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

Xem thêm