I have a scene of instanced glTFs and I’m trying to limit the ray test/console.log to a single intersection test. I’ve logged the intersect that I’m testing as follows, but the ray still passes through all of the instances (I also tried this for three single loaded glTFs with the same result). As indicated in the documentation, I’ve set the recursive flag to false.
const intersects = raycaster.intersectObjects(scene.children, false);
Here is my JSFiddle of what I’m currently encountering:
This returns multiple Instance Ids of the instanced objects (move the camera to the end of the ray and click). The goal is to only return one Instance Id, no matter the camera angle the ray is cast from. Is my syntax simply wrong? I tried the following for just a single object, but then the test is undefined:
const intersects = raycaster.intersectObject(scene.children, false);
Thanks for your help!