And i was reminded of the idea i had months ago. The generator script used the same method i used months ago, and i saw how smooth the terrain was and i thought: “So i could have just used the logic from this script”… always read the documentations people
So i got to work both making the example code shorter and more flexible, and making my own. But then i noticed something:
Mine has theese… staircase, step like structure to it, and the example one doesn’t. Even at extreme angles the example code generates smooth terrain, and mine makes rice fields.
Both use :FillBlock() and 4x4x4 blocks.
Is there something i completely ignored? Why is it like this? How can i fix this? I spent a month last time trying to figure it out and a week this time.
Any help is appreciated. If you need the code just reply. it’s not that much, anyone can make it
You’re filling with blocks so smaller blocks and smaller distances between each vertex would reduce the jaggedness. Might also be some issues with how you’re generating the amplitude for the terrain–the changes in position may be too sharp.
Here is an example that creates a 3 dimensional example that displays how the same terrain can look different depending on how exactly it is generated.
local workspace = game:GetService("Workspace")
local terrain = workspace:WaitForChild("Terrain")
for i = 1, 10 do
for j = 1, 10 do
for k = 1, 10 do
local size = 1 * j
local rough = 10 * i
for x = 1, 50, size do
for z = 1, 50, size do
local y = math.noise(x / rough, 1, z / rough) * k
terrain:FillBlock(
CFrame.new(x, y, z) * CFrame.new(-65 * i, 25 * k, -65 * j),
Vector3.new(size, 1, size),
Enum.Material.Grass
)
end
end
end
end
end
I’m ashamed i didn’t think of this earlier but to anyone reading this in the future:
Add 2 to the size of the block, so if you do 1x1x1 do 3x3x3.
In my case it’s 6 x HeightOfLayer x 6.