XRTransientInputHitTestResult: results property

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.

The read-only results property of the XRTransientInputHitTestResult interface represents an array of XRHitTestResult objects containing the hit test results for the input source, ordered by the distance along the ray used to perform the hit test, with the closest result at position 0.


An array of XRHitTestResult objects.


Accessing transient input hit test results

Two arrays are used to access transient input hit test results. First, you get an array of XRTransientInputHitTestResult objects by calling XRFrame.getHitTestResultsForTransientInput(). Second, to get to the actual XRHitTestResult objects for an input source, you dereference the results property on one of the XRTransientInputHitTestResult objects.

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

  hitTestResults.forEach((resultsPerInputSource) => {
    resultsPerInputSource.results.forEach((hitTest) => {
      // do something with the hit test


WebXR Hit Test Module
# dom-xrtransientinputhittestresult-results

Browser compatibility

BCD tables only load in the browser

See also