How do i make blocks stack on each other?
So my friend gave me this kit he made but he never told me how to make it not snap to grid
So i can make a second floor it say's it has a snap to grid setting but it does not work
Is there anyway to make it go on top of a placed item if it is hover'd over or if your mouse is in the air it goes off the ground instead of it staying on ground Here is the code
LONG CODE
001 | local function enablePlacement(plane, models, prealigned) |
002 | if (plane = = currentPlane) then |
004 | elseif (currentPlane) then |
005 | currentPlane:disable() |
008 | if ( type (models) ~ = "table" ) then |
012 | lastRenderCycle = tick() |
015 | currentBase = plane.base |
017 | local planePosition = currentBase.CFrame * Vector 3. new( 0 , currentBase.Size.Y/ 2 , 0 ) |
020 | ox, oy, oz = planePosition.X, planePosition.Y, planePosition.Z |
021 | currentXAxis = currentBase.CFrame.rightVector |
022 | currentYAxis = currentBase.CFrame.upVector |
023 | currentZAxis = currentBase.CFrame.lookVector |
024 | currentAxis = CFrame.new( 0 , 0 , 0 , currentXAxis.X, currentYAxis.X, -currentZAxis.X, currentXAxis.Y, currentYAxis.Y, -currentZAxis.Y, currentXAxis.Z, currentYAxis.Z, -currentZAxis.Z) |
026 | dxx, dxy, dxz = currentXAxis.X, currentXAxis.Y, currentXAxis.Z |
027 | dzx, dzy, dzz = currentZAxis.X, currentZAxis.Y, currentZAxis.Z |
028 | cx, cy, cz, cr = 0 , 0 , 0 , 0 |
030 | springVelocity = Vector 3. new( 0 , 0 , 0 ) |
031 | springPosition = Vector 3. new( 0 , 0 , 0 ) |
034 | tweenCurrentRotation = 0 |
035 | tweenGoalRotation = 0 |
036 | tweenStartRotation = 0 |
038 | local position, _ = inputCapture() |
040 | if ( not position) then |
041 | position = planePosition |
044 | springPosition = position |
047 | local extentsXMin, extentsXMax = 10 e 10 , - 10 e 10 |
048 | local extentsZMin, extentsZMax = 10 e 10 , - 10 e 10 |
050 | for i = 1 , #models do |
051 | local model = models [ i ] |
055 | local lookVector = object.model.PrimaryPart.CFrame.lookVector |
060 | local position = object.model.PrimaryPart.CFrame * Vector 3. new( 0 , -object.model.PrimaryPart.Size.Y/ 2 , 0 ) |
061 | px, pz = project(position.X, position.Y, position.Z) |
063 | theta = math.acos(math.clamp(lookVector:Dot(currentZAxis), - 1 , 1 )) |
064 | local cross = lookVector:Cross(currentZAxis) |
066 | if (cross:Dot(currentYAxis) > 0 ) then |
071 | px, pz = object.model.PrimaryPart.Position.X, object.model.PrimaryPart.Position.Z |
072 | theta = math.atan 2 (lookVector.X, lookVector.Z) |
075 | local x, z = model.PrimaryPart.Size.X, model.PrimaryPart.Size.Z |
077 | object.r = round((theta % ( 2 * math.pi))/(math.pi/ 2 ), 1 ) |
079 | if (object.r = = 1 or object.r = = 3 ) then |
083 | local x 1 , x 2 = px + x/ 2 , px - x/ 2 |
084 | local z 1 , z 2 = pz + z/ 2 , pz - z/ 2 |
086 | if (x 2 < extentsXMin) then |
089 | if (x 1 > extentsXMax) then |
093 | if (z 2 < extentsZMin) then |
096 | if (z 1 > extentsZMax) then |
101 | model.PrimaryPart.Transparency = . 5 |
102 | model.PrimaryPart.Anchored = true |
103 | model.PrimaryPart.CanCollide = false |
105 | setState(object, plane.loading and states.loading or states.neutral) |
107 | currentObjects [ i ] = object |
110 | currentExtentsX, currentExtentsZ = round(extentsXMax - extentsXMin, currentPlane.grid), round(extentsZMax - extentsZMin, currentPlane.grid) |
112 | for i = 1 , #currentObjects do |
113 | local object = currentObjects [ i ] |
117 | local position = object.model.PrimaryPart.CFrame * Vector 3. new( 0 , -object.model.PrimaryPart.Size.Y/ 2 , 0 ) |
118 | px, pz = project(position.X, position.Y, position.Z) |
120 | px, pz = object.model.PrimaryPart.Position.X, object.model.PrimaryPart.Position.Z |
123 | object.px = px - (extentsXMin + extentsXMax)/ 2 |
124 | object.pz = (pz - (extentsZMin + extentsZMax)/ 2 ) * (prealigned and - 1 or 1 ) |
126 | object.sx, object.sy, object.sz = object.model.PrimaryPart.Size.X, object.model.PrimaryPart.Size.Y, object.model.PrimaryPart.Size.Z |
130 | renderConnection = runService.RenderStepped:connect(run) |
131 | module.currentPlane = currentPlane |
132 | currentEvent = Instance.new( "BindableEvent" ) |
134 | if (GRID_TEXTURE) then |
135 | currentTexture = Instance.new( "Texture" , currentPlane.base) |
136 | currentTexture.Texture = GRID_TEXTURE |
137 | currentTexture.Face = Enum.NormalId.Top |
138 | currentTexture.StudsPerTileU = currentPlane.grid |
139 | currentTexture.StudsPerTileV = currentPlane.grid |
146 | return currentEvent.Event |