So im basically trying to recreate "Build to survive the zombies". But i ran into this problem with my placement system. Its out of grid sometimes.
My gris size is 4x4x4
My block size is 4x4x4
My plots size is 110, 0.1, 110
Heres a video showing a bit more of what i mean: https://www.youtube.com/watch?v=gW5nl1tIkws
This is my code that handles movment:
if RAY then CAN_PLACE = true local X = math.floor(POS.X / 4 + 0.5) * 4 -- // POS is the rays hit position local Z = math.floor(POS.Z / 4 + 0.5) * 4 local Y = math.floor(POS.Y / 4 + 0.5) * 4 local NEW_CF = CFrame.new(X, Y, Z) + (SURFACE * (CURRENT_OBJECT.PrimaryPart.Size * .5)) CURRENT_OBJECT:SetPrimaryPartCFrame(NEW_CF * CFrame.Angles(0, math.rad(CURRENT_OBJECT.PrimaryPart.Orientation.Y), 0)) end