Ok i'veI've been trying to create a grid system that can use any grid size and start at any given anchor point rather than always at 0,0.
Bounds Span : 1f2f by 1f2f
Grid Size : 1f by 1f
Center point : 3.97f , 2.7f (the red dot)
Notice my for loop now runs one extra time some times, i have tried casting and flooring to int, both don't fix the problem, and thats because float imprecision is the cause, for example i've had 2.000000000f cast to int as 1.. so it still didn't work. if i cast the result of the division because it would be off by 1 in my for loops, see here: