XRTransientInputHitTestResult: thuộc tính inputSource

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.

Thuộc tính chỉ đọc inputSource của giao diện XRTransientInputHitTestResult đại diện cho một đối tượng XRInputSource đã được sử dụng để tính toán mảng results.

Giá trị

Một đối tượng XRInputSource.

Ví dụ

Lọc nguồn đầu vào

Thuộc tính inputSource cho phép bạn lọc kết quả kiểm tra va chạm theo nguồn đầu vào.

js
// frame loop
function onXRFrame(time, xrFrame) {
  let hitTestResults = xrFrame.getHitTestResultsForTransientInput(
    transientHitTestSource,
  );

  hitTestResults.forEach((resultsPerInputSource) => {
    if (resultsPerInputSource.inputSource === myPreferredInputSource) {
      // act on hit test results from the preferred input source
    }
  });
}

Thông số kỹ thuật

Thông số kỹ thuật
WebXR Hit Test Module
# dom-xrtransientinputhittestresult-inputsource

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

Xem thêm