#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Snap To Isometric Grid?

Posts: 75Member

Does anyone know how I can snap actors to the center of isometric squares? There are lots of city/kingdom/ building games that use this isometric yard/landscape in which has a grid which you place your buildings/houses etc on. I was wondering how I could achieve snapping my images (Made to look 3d) onto these squares?
I saw a previous template that used the following to snap to a 2d grid:

Constrain attribute: Self.Position.x To floor(Self.position.x/64)64)+32
Constrain attribute: Self.Position.y To floor(Self.position.y/64)
64)+32

That snnapped my 64x64 pixel blocks to the center of a grids blocks, now, how can I achieve this same effect with an isometric grid? I'm not sure if it would take some tweaking with the formula above or of Id need something completely different, help would be greatly appreciated!

• ImagineLabs.rocks Posts: 5,576Member, BASIC

I believe @Socks posted a nice isometric sample at one time or another, maybe he can offer some advice.

• Posts: 75Member

Bump

• London, UKPosts: 2,301Member
edited September 2014

Well, it depends on how your isometric imagery is set up, but mostly y=1/2*x, meaning the height of the tiles is half of their width. If that is the case, your calculation should be:

Constrain attribute: Self.Position.x To floor(Self.position.x/64)*64)+32

Constrain attribute: Self.Position.y To floor(Self.position.y/32)*32)+16