I made a grid (well, it’s just a plane with texture tiled 250x250 so I have 250x250 squares).
It works just as I need but I am having trouble snapping to middle of square.
Each square is 100x100 size.
I have a function called getCursorPosition (which as name suggests - gets cursor position in game space).
This function also calls another function - getNearestSnap (which should ideally get nearest square center).
(My grid points are just based on coordinates in world space, it doesn’t check for grid lines or anything as it’s just texture).
The issue is in getNearestSnap.
If I change values to 100 - it works okay (but it ends up on grid lines rather than in middle of each square).
Since I changed it to 50 - it snaps to both - grid lines, grid intersections and square centers.
I need to limit it to snap to square centers only (so get nearest square center pos).