Randomly generated planets (parts)

Hi, I’d like to randomly generate a sphere planet with some hills that vary in size, I’d preferably like to use parts when generating.

Well I think the hard part is turning it into a circle I know how to make a good map thats generated with a map

I just merged math.noise to make the hills / biomes / rivers / oceans
But it would be really hard to make it a circle ( I think )

1 Like

Ah thanks, I heard of math.noise and experimented with it but I have no idea how to make it sphere.

Yeah there would be gaps and stuff in the world I don’t know how to make it look good
And I would have to merge the edges of the noise function it would get pretty messy really quick

I think there 100% is a way to do it efficiently though

1 Like

Alright, cheers for the help mate.

1 Like

local parts = game:GetService("Workspace").Parts

local function createCircle(radius)
	local circle = Instance.new("Part")
	circle.Anchored = true
	circle.Shape = "Cylinder"
	circle.Size = Vector3.new(radius*2,0.2,radius*2)
	circle.CFrame = CFrame.new(0,0,0)
	
	return circle
end

local function createHills(radius,height,count)
	local hills = {}
	
	for i = 1, count do
		local hill = Instance.new("Part")
		hill.Anchored = true
		hill.Shape = "Ball"
		hill.Size = Vector3.new(radius,height,radius)
		hill.CFrame = CFrame.new(0,0,0)
		
		table.insert(hills,hill)
	end
	
	return hills
end

local function randomizeHills(hills,radius)
	local rotation = math.pi*2/#hills
	
	for i,hill in ipairs(hills) do
		local angle = i*rotation
		local x = math.cos(angle)*radius
		local z = math.sin(angle)*radius
		
		hill.CFrame = CFrame.new(x,0,z)
	end
end

local radius = math.random(5,10)
local circle = createCircle(radius)
circle.Parent = parts

local count = math.random(5,10)
local height = math.random(1,5)
local hills = createHills(radius,height,count)
randomizeHills(hills,radius)

for _,hill in ipairs(hills) do
	hill.Parent = parts
end
1 Like

Sorry I miss typed I was trying to make one that is a sphere with hills.