I've started writing code for collision detection in a 2D game, and common methods I've seen include gridding and quadtrees. I also plan to use them for nearest neighbour searches, etc.
I see mostA lot of games store object positions as floats and have a closed ball for the game area (eg. a rectangle and objects are allowed to have position coordinates on all 4 edges).
However, this becomes problematic when dividingpartitioning the game area up (for botheg. gridding/quadtrees). You'll either have to includeThe edge cases would have to be added in your code so that 2 edges of the game area are included in rectangles that touch them or you miss out 2 edges in collision detection (in which case objects on those2 edges won'twould have to be missed out in the grid/tree)partition.
I haven't seen this sort of problem mentioned in any of the articles I've read/when I search it up. So I wonder - isIs there another solution to this or do games (and other programs this applies to) usually go with one of the above 2 solutions?
(In one example I noticed object positions were integers which avoids this problemOne solution is to use integer coordinates, but I'd rather keep them aswhat if using floats in the game I'm makingis unavoidable?)