Search code examples
reactjsthree.jsreact-three-fiber

react-three/fiber detect click on empty area


Im wondering how to detect a click on an empty space on my canvas using react-three/fiber. For example to deselect an object. Is there a build in way or do I have to implement a raycaster?

thanks in regard.


Solution

  • Try using onPointerMissed on the <Canvas> element, as documented here: https://docs.pmnd.rs/react-three-fiber/api/events