Procedural Solar System Generation is a Unity project that generates a solar system with stars, planets, and moons using procedural generation techniques.
- Clone the repository
- Open the project in Unity
- Open the
MainScenescene located in theAssets/Scenesfolder - Press the Play button in the Unity editor to start the simulation
- Generation of one or more stars with random size, position, and emission
- Generation of one or more planets for each star using the Titius-Bode formula to determine their position and Kepler's laws to determine their speed and orbit
- Generation of one or more moons for each planet with random size and orbit
- Physics-based gravity calculations between celestial objects
- Procedural generation allows for the creation of unique solar systems with just a few clicks
The MainScene scene contains a SolarSystemGenerator script that generates the solar system. The script generates a specified number of stars and a specified number of planets orbiting the first star.
To customize the solar system, you can modify the following properties in the SolarSystemGenerator script:
numberOfStars: The number of stars to generatenumberOfPlanets: The number of planets to generate orbiting the first starmaxNumberOfPlanets: The maximum number of planets to generate orbiting a star
The solar system simulation can be run in the Unity editor by pressing the Play button.
Stars are generated using the StarGenerator script. To customize the stars, you can modify the following properties in the StarGenerator script:
minStarRadius: The minimum radius of the starmaxStarRadius: The maximum radius of the starstarSubdivisions: The number of subdivisions used to generate the star's meshstarOrbitDistance: The distance from the origin at which the star is generated
Planets are generated using the PlanetGenerator script. To customize the planets, you can modify the following properties in the PlanetGenerator script:
maxNumberOfMoonsPerPlanet: The maximum number of moons that can be generated for a planetminPlanetRadius: The minimum radius of the planetmaxPlanetRadius: The maximum radius of the planetplanetSubdivisions: The number of subdivisions used to generate the planet's meshorbitalSpeedMultiplier: The multiplier used to calculate the planet's orbital speedrotationSpeedMultiplier: The multiplier used to calculate the planet's rotation speed
Moons are generated using the MoonGenerator script. To customize the moons, you can modify the following properties in the MoonGenerator script:
minMoonRadius: The minimum radius of the moonmaxMoonRadius: The maximum radius of the moonmoonSubdivisions: The number of subdivisions used to generate the moon's meshmoonOrbitDistance: The distance from the planet at which the moon is generatedrotationSpeedMultiplier: The multiplier used to calculate the moon's rotation speedorbitalSpeedMultiplier: The multiplier used to calculate the moon's orbital speed
Contributions to Procedural Solar System Generation are welcome and encouraged! To contribute, please follow these steps:
- Fork the repository
- Create a new branch for your contribution
- Make your changes
- Test your changes
- Submit a pull request
This project is licensed under the Creative Commons Zero v1.0 Universal license (CC0). You are free to use the material for any purpose, without any conditions, including commercial use. You can copy, modify, distribute and perform the work, even for commercial purposes, without asking permission.