Open Zizico2 opened 2 months ago
I can reproduce it with your example. If I had to guess, it's some kind of floating-point math error, but when logging the cursor position and x/y, I get whole numbers, so I'm not entirely sure.
When the stars align, the ray cast appears like it's failing to resolve anything on some of the squares (note "some" as it only happens to the right-hand side of the board for me, so maybe as x increases, the margin of error increases?). Still, if you move everything by 1, it no longer has an issue AFAICT. Alternatively, if you set your camera translation to (0,0,0)
, it appears to be fine, at least until you maximize the window. Maybe it's something to when coordinates get to a specific size?
Vertical adjacencies don't seem to be an issue, or maybe you need a larger grid to see them.
I believe I have found the potential root cause and opened https://github.com/aevyrie/bevy_mod_raycast/issues/118
In 2d, when I have 2 Meshes that are exactly adjacent to each other, I can position the mouse right on the edge between them, and the click won't be captured. Is this how it is supposed to work? User error?
For example, creating a chessboard like this (every square is exactly
50
wide, and50
away from each other, you can put the mouse right between the squares and the click won't be recognized.