Snapping For TileManager

I’m on mobile so apologies for any mistypes.

I’ve a TileManager project all made under my own steam, very happy with it, bit and pieced it together through various hints and displays.

Right now though I’m at a point where I need it to snap to some uniform layout and I’m not sure how to do so. Do I require having a predefined grid that gets filled? Can I just compare and and down movement (as with left and right) and see which is closer to some modulo of like the tilesize?

The math/path is confusing me and just want some help on understanding how to appreciate and create a solution to this? Every guide I find doesn’t answer this, it’s always done in a way I don’t want i.e. building next to the last spawned tile or just filling a grid and deleting from there.

Cheers for any help.

So you’re trying to snap to a grid as opposed to snap to a previously placed tile? Easiest method is to just round the position of the tile to your grid increment (ie - if your grid is 1 unit round to closest whole number, if it’s half unit round to nearest .5 etc)

Well there isn’t a grid strictly speaking, it’s just world space that I’m instantiating onto, guessing that doesn’t change what’s needed though.

Sorry - this is what I meant when I said grid. :slight_smile: