|
| 03 Nov 2013 06:45 AM |
What function should I use for my terrain generator? I'm currently using y = z - x .
v = 0 space = 0 t = 0 function terrain(height,depth,fragment,change) for i = 1, fragment^2 do depth = depth + 1 v = v + 1 t = t + 1 x = game.Workspace.Baseplate.Size.X / fragment y = 1 z = game.Workspace.Baseplate.Size.Z / fragment if v == fragment + 1 then space = space + 10 v = 1 depth = -t/100 + 1 wait() end game.Workspace.Baseplate.CanCollide = true game.Workspace.Baseplate.Transparency = 0.4 game.Workspace.Baseplate.BrickColor = BrickColor.new("Bright blue") plate = game.Workspace.Baseplate:Clone() plate.Transparency = 0 plate.Parent = game.Workspace if depth > change then plate.BrickColor = BrickColor.new("Bright green") elseif depth < change then plate.BrickColor = BrickColor.new("Bright yellow") end plate.Name = "part" plate.Size = Vector3.new(x, y, z) Py = game.Workspace.Baseplate.Position.Y + depth Px = game.Workspace.Baseplate.Position.X - (game.Workspace.Baseplate.Size.X/2 - x/2 - (v * x - x)) Pz = game.Workspace.Baseplate.Position.Z - (game.Workspace.Baseplate.Size.Z/2 - x/2 - space) plate.CFrame = CFrame.new(Px, Py, Pz) end end
terrain(100,0,100,20)
|
|
|
| Report Abuse |
|
|
|
| 03 Nov 2013 06:46 AM |
The result looks like this: http://www.roblox.com/Scaled-Terrain-Generation-place?id=132523390 |
|
|
| Report Abuse |
|
|
As8D
|
  |
| Joined: 24 Dec 2009 |
| Total Posts: 2907 |
|
|
| 03 Nov 2013 06:52 AM |
Hm...
I'd expect some random terrain instead of just a tilted plate made of 5x5 or whatever the size was-parts.
So yerh, come again with something amazing ):
- As, that means you need 65k x 65k grid n' streamin' parts n' physic effektz^2. |
|
|
| Report Abuse |
|
|
|
| 03 Nov 2013 08:24 AM |
One thing that makes terrain generation look really fancy is using trig functions!
So you can make a nested for loop for the X and Z axis and make the height equal to sin(z) + cos(x) or something like that.
You might need to multiply stuff around so the trig functions are bigger or smaller though. |
|
|
| Report Abuse |
|
|