I'm not sure how to explain it but when in these games you have a sort of building tool you can only place it in a specific way, like the ROBLOX stamper tool. Are there literally invisible tiles or is there some fancy math going on?
I just had to debunk that for you. You're welcome. What actually happens is that when they get your mouse hit position (mouse.Hit.p
) they round off the X and Z axes. Here's an example implementation:
local function RoundTile(MousePosition, TileSize) -- I've been using js too much recently I just tried to use {} for the function body. local x,z = MousePostion.x, MousePosition.z x = math.floor(x/TileSize + 0.5)*TileSize z = math.floor(z/TileSize + 0.5)*TileSize return Vector3.new(x, MousePosition.y, z); end;
MousePosition
is the position that the Mouse is pointing at (Mouse.Hit.p
)TileSize
is the size of every tile. Simples. squeak