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.
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.
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.