Original Post
Hello. Im working on my level editor and im currently trying to implement the "snapping" of objects to the grid. But i cant figure out how to know when a object should snap. I have my grid, which i know the size of. I also know the resolution of the grid. So if the grid is say 64x64 units large. And its subdivided into 8x8 squares. And an object is at position x,y and is currently beeing translated along the x-axis. Then how do i calculate if the object is close enough to a "line" to snap to it? Anyone know? Thanks in advance. // Peter B