diff --git a/src/core/usePointer.ts b/src/core/usePointer.ts index 1938cdf..b324f89 100644 --- a/src/core/usePointer.ts +++ b/src/core/usePointer.ts @@ -181,7 +181,7 @@ export default function usePointer(options: PointerConfigInterface): PointerInte function pointerClick(event: TouchEvent | MouseEvent) { updatePosition(event) if (intersectObjects.length) { - const intersects = raycaster.intersect(positionN, intersectObjects) + const intersects = raycaster.intersect(positionN, intersectObjects, intersectRecursive) const iMeshes: InstancedMesh[] = [] intersects.forEach(intersect => { const { object } = intersect diff --git a/src/core/useRaycaster.ts b/src/core/useRaycaster.ts index 2ebf662..823bd6f 100644 --- a/src/core/useRaycaster.ts +++ b/src/core/useRaycaster.ts @@ -4,7 +4,7 @@ import { IntersectObject } from './usePointer' export interface RaycasterInterface { position: Vector3 updatePosition(coords: Vector2): void - intersect(coords: Vector2, objects: IntersectObject[], recursive: boolean): Intersection[], + intersect(coords: Vector2, objects: IntersectObject[], recursive?: boolean): Intersection[], } export interface RaycasterConfigInterface {