Hello forum!
I'm currently trying to minimise collision checking.
The mouse clicks and my program checks whether it did hit a bunch of 2d triangles.
The red point represents the 1px thick click. Two triangles form the upper and lower part of a tile.
Easiest solution: I could bruteforce through all triangles until I find one that contains the click.
My "improvement": I check on whether which square of a tile the mouse click is near to. By dividing the mouse click's coordinates and mapping them to the grid.
Via this way, I find the blue square on the photo. What I can do now, is looking at the IEEE numbers and ceiling() floor() them, to find potential tiles.
These are the white ones. I would have to check the black one, upper and lower part (in this case, I found it after checking the upper one), and the halves of the upper white ones (coloured purple and cut-off by blue).
The grey ones are just to show the continuation of the grid.
However, I feel like this way is inefficient and maybe too complex already?