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.
Value
An array of XRHitTestResult
objects.
Examples
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.
function onXRFrame(time, xrFrame) {
let hitTestResults = xrFrame.getHitTestResultsForTransientInput(
transientHitTestSource,
);
hitTestResults.forEach((resultsPerInputSource) => {
resultsPerInputSource.results.forEach((hitTest) => {
hitTest.getPose(referenceSpace);
});
});
}
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
results |
81 |
81 |
No |
No |
68 |
No |
No |
81 |
No |
58 |
No |
13.0 |
See also