Create "terrain" on pre-generated ball planet

I’ve been trying to make a planet generation with the roblox terrain using :FillBall. Here is what I did, it just generates a terrain ball in random positions and also with random material.

for i = 1,100 do
	local material = math.random(1,4)
	if material == 1 then
		local size = math.random(5,500)
		local randomposX = math.random(-10000,10000)
		local randomposY = math.random(-10000,10000)
		local randomposZ = math.random(-10000,10000)
		game.Workspace.Terrain:FillBall(Vector3.new(randomposX,randomposY,randomposZ), size, Enum.Material.Ground)
	end
	
	if material == 2 then
		local size = math.random(5,500)
		local randomposX = math.random(-10000,10000)
		local randomposY = math.random(-10000,10000)
		local randomposZ = math.random(-10000,10000)
		game.Workspace.Terrain:FillBall(Vector3.new(randomposX,randomposY,randomposZ), size, Enum.Material.CrackedLava)
	end
	
	if material == 3 then
		local size = math.random(5,500)
		local randomposX = math.random(-10000,10000)
		local randomposY = math.random(-10000,10000)
		local randomposZ = math.random(-10000,10000)
		game.Workspace.Terrain:FillBall(Vector3.new(randomposX,randomposY,randomposZ), size, Enum.Material.Rock)
	end
	if material == 4 then
		local size = math.random(5,500)
		local randomposX = math.random(-10000,10000)
		local randomposY = math.random(-10000,10000)
		local randomposZ = math.random(-10000,10000)
		game.Workspace.Terrain:FillBall(Vector3.new(randomposX,randomposY,randomposZ), size, Enum.Material.Ice)
	end
	if material == 5 then
		local size = math.random(5,500)
		local randomposX = math.random(-10000,10000)
		local randomposY = math.random(-10000,10000)
		local randomposZ = math.random(-10000,10000)
		game.Workspace.Terrain:FillBall(Vector3.new(randomposX,randomposY,randomposZ), size, Enum.Material.Slate)
	end
end
3 Likes

and what did u want to achieve?

1 Like

A planet generation with craters and some other terrain elevations

1 Like

yeah so thats going to be more difficult you are going to need to make a variable of the center of the planet (vector3 position) then a variable for the raidius of that planet (number) then u are going to need to take vectors in random directions of slightly random lengths relative to the radius size and You can clear a certain region of terrain using game.Workspace.Terrain:FillRegion() and fill it with Enum.Material.Air to form ur crators or fill with more ground to make a hill thatll give a roughhhhhh version of what u want it

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.