Problems while generating solar system.

Hello

I want to generate a solar system.

This is how it looks like: http://i.imgur.com/xZEuCGY.png (The lighter sphere is the sun, and the darker ones are the planets.)
The blueprint: http://i.imgur.com/aWSxmCJ.jpg

The white sphere is the sun, black is planet.

I’m facing a problem.

Many many times, the planet created inside a star, how can I avoid this? I would love to have the ability to rotate them a bit later, I mean that would be good if they would have different path to move on.
And there should be minimal distance. There are no moons in the blueprint yet.

There is another image, you can see everything here: http://i.imgur.com/qKF8glI.jpg

I’m waiting for your advices, I want to make it in blueprint, I would love to avoid coding as long as I can.

So this may be a simplistic and possibly stupid idea, but maybe you could just repeat generating a planet if it happens to overlap another? Basically OnBeginOverlap delete the offending planet and generate it again. Kind of like a dumb lottery number generator that looks up if a number has already been drawn and if so just repeats until all is well.

Assuming the sphere’s origins are their centers: Sun origin + sun radius + minimum distance + planet radius = [actual] minimum distance

Should be easy to extend to a moon as well, right?

Generate them all in a straight line so the math is easier, then decide the starting orbital rotation in the next step with a random from 0-359 and rotate each body around the sun by that much.

.

Thank you for the advices. I’m trying to find the best solution.

Create a list (array) of orbits (floats) for your planet and store them in the Sun BP for access later on.

For example: the first orbit at 20 + random 1-10, second on at 35 + random 1-10 and so on. This way they will never overlap.
Simplified math above can be made better, ofc.

I have resolved it with this solution. Ty