@threlte/xr
Version:
Tools to more easily create VR and AR experiences with Threlte
23 lines (22 loc) • 673 B
TypeScript
import { Matrix4 } from 'three';
export type HitTestCallback = (hitMatrix: Matrix4, hit: XRHitTestResult | undefined) => void;
export type UseHitTestOptions = {
/**
* The ray source when performing hit testing.
*
* @default 'viewer'
*/
source?: 'viewer' | 'leftInput' | 'rightInput';
};
/**
* Use this hook to perform a hit test per frame in an AR environment.
*
* ```ts
* useHitTest((hitMatrix, hit) => {
* mesh.matrix.copy(hitMatrix)
* }, {
* source: 'viewer' | 'leftInput' | 'rightInput' // Default 'viewer'
* })
* ```
*/
export declare const useHitTest: (hitTestCallback: HitTestCallback, options?: UseHitTestOptions) => void;