How to know if the cursor is close to any of the plane mesh edge

How to know if the cursor is close to any of the plane mesh edge, cause i want the mouse to be snapped at that edge

You can put invisible box at each edge and check for intersections with these invisible boxes instead of intersections with the plane itself.

hello @mjurczyk
i saw one of your replies to the same issue, but the thing is am having a lot of planes maybe about 20 so i think that this solution will not be friendly with the performance

Taking into consideration these boxes are hidden and never rendered - wdym it would not be friendly to the performance? (Additionally, you don’t even have to add them to the scene, making them entirely ignored by rendering - just add them to some virtual array and raycast against that array.)

ok i understand now, but do you know how we can listen to the invisible box once the cursor touches it if that box is not in the scene, am using react three fiber ( sorry don;t add a virtual array, if you have some code examples it would really help )

20 planes is really fast to raycast. I would worry more about that performance when you start getting over 100 or 1000.