Hello.
I’ve recently written a landscape generator for my survival game.
I’ve made it generate the terrain in Parts with the cube shape (image), but how would I be able to replace the
cubes with triangles?
Here is the code that I currently have:
local freq = 0.1
local seed = os.clock()
local waterthreshold = 0.3
local mult = 5
for x = 1,50 do
for y = 1,50 do
local part = Instance.new("Part")
print(x.." "..y.." freq: "..freq)
local noise = math.noise(((x / mult) + seed) * freq, ((y / mult) + seed) * freq)
print(noise)
part.Anchored = true
part.Size = Vector3.new(1 * mult,1 * mult,1 * mult)
part.Position = Vector3.new(x * mult,0,y * mult) + Vector3.new(0,math.clamp(noise * mult,0,1 * mult),0)
part.Parent = workspace
if noise < waterthreshold then
part.BrickColor = BrickColor.new("Baby blue")
part.Position = Vector3.new(x * mult,waterthreshold,y * mult)
else
part.BrickColor = BrickColor.new("Sea green")
end
end
end
How would I triangulate the terrain made by those values?
Any support is appreciated.
Thank you.