Proprietary code - No Access //
It’s because you are using the center of the tiles,which doesn’t work when you’re comparing 10 and 5, because of this: If you set both of them to the center, this is how it’d look.
They’re offset by half.
On the 10x10, the floor’s border is halfway between 2 grid sizes. On the 5x5, it’s directly on the grid size. This means you’re out of alignment by half a grid-size, on the 5x5. And looking at it, it seems to be true: you are off half a grid-size (2.5,2.5)
Also, you should be centering your tiles with an offset either way.
That way you won’t have this problem.
I want it so the object is placed with the object at the center of the mouse. If I offset it to the top corner it doesnt achieve this affect
You can, you just need to also add the offset to the mouse pos.
wont this break the scenario with 10 studs?
Not if you do it correctly. You’re just ‘sorting’ the tiles into the bottom left of a cell instead of the center.
Not half of the model, half of the gridsize. Also, you’re rounding wrong.
local function roundInput(value, GRID_SIZE)
return math.round(value/GRID_SIZE)*GRID_SIZE
end
Proprietary code - No Access //
You’re not understanding me … you need to adjust for the fact that you’re offsetting to the corner. Then the mouse will work anyways.
Okay so I see this but I am still a bit confused on how to change the equation. Do you mind telling me the equation?
That’s a cheat sheet for calculating other values, when you have 1. So for example, if you have 1 point, you can calculate the position of the 4 tiles that touch it. But ONLY if you’re offsetting into the corner, that’s why the point is q,r and the tile is q,r.
You just need to set the pivotOffset of the tile to be tile.Size divided by 2 (that’ll put it in one of the corners, maybe it needs to be inverted). And then you can just use tile:PivotTo(), it’ll move it into the corner
I am tweening not pivotting. I want a smooth build system
What if I pivot it, save the CFrame, then tween it to that area?
You shouldn’t tween it anyways; too slow imo. Much better to CFrame it. You can still smooth it out with lerp.
You can do that, yea.
You can speed up a tween
I have never used lerp before but it seems outdatted (a lot more common in old scripts than new)
Lerp is just math. It’s like saying, a^2+b^2=c^2 is outdated; it’s not, because outdated means there’s better ways to do it. There aren’t.
Sorry, I should be more clear. It’s more performance intensive than a lerp.
Okay so I tried your method however it still does this for 10. It appears to be the exact same thing as my previous method (except my previous method allowed for tweening)
Please note that for every other grid size for this specific object it works
Send me the code please, this is too inefficient
I also tried with 1,1 and it does it as well I forgot to mention
we