Ok, so I have a player object that can move freely in all directions, with no snapping to the above mentioned grid. I need to figure out in which square of the grid that object is.
The grid is not a game object itself currently, it’s only meant to give a rough position of the player (GridX, GridY) for some other objects to use. It starts as (0,0) in the lower left corner of the screen (this is a static level) and increases in both axis across the screen. The grid divisions are square, and the size of each square is a fixed number of Unity units (I don’t know how big it should be yet, sprites aren’t in). The grid is also always only 10x4, and the player can only move within it (that part’s easy enough, though).
I can’t just do this with a big stack of ifs, there must be a better way.