Best way to randomly place planets to generate universe?

Hi, I am relatively new to UE4, and am wondering what the best way would be to procedurally place down planets when a new save is created. I’ve experimented a good deal with just a simple spawn actor then randomizing a transform input, but haven’t been able to get it to work properly.

Just take a random unit vector at 0,0,0 and multiply it by a random float. Do this for each planet.

You will also have to check they don’t overlap…

You would be spawning blueprints ( probably ), but here’s the vector concept:



I’m also thinking you’ll want to spawn in a circular orbit. The BP below can help with that:

Reference: Spawning dynamic objects along the circumference of a circle

On top of that, you’ll want to use random streams. They allow you to make your universe consistent, yet random. The random stream’s results are based on a number called the “seed”, which will decide all of the random choices. Two universes with the same seed will be similar, but a different seed will result in an entirely different universe. Make sure you always use the same random stream, and pass it by ref, though.

1 Like

Solar System RND Download

Combine with SaxonRah’s Solar System Blueprint Download