[Solved] Snap to grid extension not accurate

Hi, I was using the snap to grid extension or making the pick and place mechanic for my game and I found out that it is not accurate, you can see this as the yellow object that snap to grid is not in the nearest grid to the cursor

(Please ignore the sreenshot panel :sweat_smile::wink:)

I know that it might be a user made extension. But, maybe changing the values given might help, But, I don’t know what is happening here :sweat_smile: Here is what is given:

Thank for helping!

i dont know the extension, but the formula its using, is pretty much accurate ( i use this formula to correct positions of pathfinding objects, to guarantee that there position perfect)
So your problem lies likely elsewhere.

if i look at your screenshot, i cannot figure out what your grid is.
The objects, that are supposed to be but on the grid should be the same size as a grid cell with 0/0 origin point.
keep the origin points in mind.

1 Like

The size of the objects are 32x32 and the grid size is also 32x32. So, is there any way to make the script to chose the grid nearest to the mouse?

should be the same formula but with MouseX/Y

1 Like

You mean change the object.x with mouse.x?

exactly.
while var placed of object = 0
set position of object to above formula, but mouseX/Y.

1 Like