WebXR Device API
The read-only inputSource property of the XRTransientInputHitTestResult interface represents an XRInputSource object that was used to compute the XRTransientInputHitTestResult.results array.
Value
An XRInputSource object.
Examples
Filtering input sources
The inputSource property allows you to filter hit test results by input source.
// 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
}
});
}
Specifications
Browser compatibility
See also
- XRInputSource
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
