In-game buiding structure

Hello guys…
I have scripted moving with my first buildable object… And I have scripted grid for building…
But I have one little problem… I need to locking my object to corners of every block of grid…
Here is some screens how I have scripted moving with buildable object and how I have scripted grid…

Moving with object:
8fd43105074ad592a309c1347547a940dd59c379.jpeg

Big grid:
b6c8cc5ba4887cf2e168258331b7ec6acf195c3d.jpeg

I need to allow building only on the corners of blocks of grid (sims1-3)…
Please help me guys…