#How to hover object use raycaster function?
6 messages · Page 1 of 1 (latest)
lot of examples are available on the official site, covering all possible cases . They use raycasting inside the renderer loop. The most basic to start with, is this one (simple raycast per object, under the mouse)
https://threejs.org/examples/?q=raycast#webgl_interactive_cubes
on the page, click bottom-right to show the code
hover isn't trivial because you need to book keep hover state. a serious implementation with hover between multiple objects can quickly get complicated. here's a very naive implementation: https://codesandbox.io/s/basic-threejs-example-with-re-use-dsrvn
the alternative is this: https://codesandbox.io/s/basic-react-example-with-re-use-e2zit these behave like real pointer-events, stoppropagation, pointer capture and all
welp...webGL doesn't contain any mouse reference anyway.
this question can't be answered without using weird shenanigan to emulate the thing 🤣
Tks guy, I solved it. Thanks your link, it helped me so much