Raycasting to points when zooming #364
Replies: 3 comments 2 replies
-
there is a property in the raycaster that you need to set, Points: { threshold: 1 }, or something like that. unfortunately that's how it is in threejs. you will have to change this threshold when you zoom. r3f can't do it for you. |
Beta Was this translation helpful? Give feedback.
-
I've figured out a solution. I didn't realize that the raytracer was exported from useThree(). If I modify the threshold property there, raycasting to points works as expected. Should this be added to the API section of the readme? Not mentioning the raytracer there tripped me up. |
Beta Was this translation helpful? Give feedback.
-
could you add it? will merge when i find time. everything that's useful in any way i in the state model, but must've forgot to document some of them. |
Beta Was this translation helpful? Give feedback.
-
Hi Everyone!
I'm having some trouble selecting points when zooming. I can set the point threshold as a canvas raycaster property, but I'm having trouble updating the threshold as I zoom in and out. My attempt so far is to track the zoom of the camera as a state variable and update the canvas raycaster property as the state changes accordingly.
Changing the raycaster property in this way doesn't seem to have any effect (i.e. it doesn't seem to update). Is there a more appropriate way to modify the raycaster threshold as the zoom level changes? I've set up a CodeSandbox for a minimal example. I've messed with the default camera and orbit controls for my application, so this may be contributing to the issue.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions