So I tried to make my procedural or voxel generation more smooth with wedges but it didn’t work.
So I don’t know what to try next.
mapxSize = 128
mapySize = 64
mapzSize = 128
noisescale = 30
amplitude = 20
blockSize = 4
areaAddition = - 288
function Generate(areaNumber, color)
local seed = math.random(0, 1000000)
areaAddition += 288
for x = 0,mapxSize do
for z = 0,mapzSize do
for y = 0,mapySize do
local xPerlin = math.noise(y/noisescale,z/noisescale,seed) * amplitude
local yPerlin = math.noise(x/noisescale,z/noisescale,seed) * amplitude
local zPerlin = math.noise(x/noisescale,y/noisescale,seed) * amplitude
local density = xPerlin + yPerlin + zPerlin + y
local densityX = xPerlin + yPerlin + zPerlin + x
local densityZ = xPerlin + yPerlin + zPerlin + z
if density < 10 and -density < 10 and densityX < 35 and densityZ < 35 and -densityX < 35 and -densityZ < 35 then
local block = Instance.new("Part", workspace[areaNumber].Generation)
local blockCheck = Instance.new("Part", workspace[areaNumber].Generation)
block.Name = "Block " .. y
block.TopSurface = "Smooth"
blockCheck.Size = Vector3.new(blockSize, blockSize, blockSize)
blockCheck.Transparency = 1
local randomOrientation = math.random(0,2)
if randomOrientation == 1 then
block.Orientation = Vector3.new(0,90,0)
else
block.Orientation = Vector3.new(0,-90,0)
end
block.BottomSurface = "Smooth"
block.Material = Enum.Material.SmoothPlastic
block.Anchored = true
block.Size = Vector3.new(blockSize, blockSize, blockSize)
block.CFrame = CFrame.new(x*blockSize + areaAddition ,y*blockSize,z*blockSize)
blockCheck.CFrame = CFrame.new(x*blockSize + areaAddition ,y*blockSize + 4,z*blockSize)
blockCheck.CanCollide = false
block.Color = color
blockCheck.Anchored = true
local wedge = Instance.new("WedgePart", workspace[areaNumber].Generation)
wedge.Name = block.Name .. "'s Wedge"
wedge.CFrame = CFrame.new(block.CFrame.X, block.CFrame.Y + 4, block.CFrame.Z)
wedge.Size = Vector3.new(blockSize, blockSize, blockSize)
wedge.Anchored = true
wedge.Orientation = block.Orientation
wedge.Color = color
blockCheck.Touched:Connect(function(part)
if part.Name == "Block " .. y - 1 then
if part:IsA("Part") then
if part.Parent.ClassName ~= "Model" then
wedge:Destroy()
end
end
end
end)
end
end
end
wait()
end
print(areaAddition)
end
Generate(1, Color3.fromRGB(123, 215, 97))
Thanks!