react-three-legacy
react-three-legacy copied to clipboard
Performance with pointer events if a lot of objects are on the scene
The function projectPointerEvent
raycasts on every child, no matter if a certain child needs pointer events.
It would probably better to filter out children that not have defined onClick3D or similar.
Also it would probably good to be able to assign additional event listeners to the <Scene>-Component (e.g. as mentioned here https://github.com/Izzimach/react-three/issues/87)
I don't really want to proscribe a specific baked-in strategy to handle many objects, since it can depend on how the scene is specifically set up.
Maybe allow the user to provide a custom raycast handler, with the fallback/default being what it is now, just iterating over all children?