Hi - This may be a lazy way of working this to spare the time of building however; I was wondering if there were an easier way of designing ‘space quadrants’ in my game - Below is an example of what I’m meaning.
I aim for main Planets to be along a certain Y vector - In this case ( Y = 250 ).
Then to have smaller planets around the top and lower layer of the Planets.
Is there any examples of how I may do this?
New to generation scripting.
Edit: Created a base code that is far from perfect - As you can see, I face the issue of Planets spawning within each-other etc.
local Base = script.Parent["Base"]
local Template = script["Template"]
local Position
local Size
function GeneratePlanets(i)
local Clone = Template:Clone()
Clone.Parent = Base
Clone:SetPrimaryPartCFrame(CFrame.new(Position))
Clone["Core"].Size = Vector3.new(Size, Size, Size)
Clone["Core"]["AT0"].Radius = Size / 2 + 5
Clone["Core"]["AT1"].Radius = Size / 2 + 10
end
function GenerateAxis(i)
if i == 1 then
Position = Base.Position + Vector3.new(0, 100, 0)
else
Position = Base.Position + Vector3.new(math.random(-Base.Size.X / 2, Base.Size.X / 2), 100, math.random(-Base.Size.Z / 2, Base.Size.Z / 2))
end
Size = math.random(50, 150)
end
for i = 1, 5 do wait()
GenerateAxis(i)
GeneratePlanets(i)
end