Solar System — Exploration in Unity

Pat Guillen
4 min readApr 26, 2022

--

Objective: Is to learn more thru discovery and practice. I chose to make a solar system, since it mirrors a similar project that I will be presenting on June 10th. Therefore, a lot of the scripts I will be reusing or editing to work for both. Working on making this solar system with a spaceship exploration using Force, Torque, and Rotate. The overall point is to take small concepts and extend them as I learn more in both AR/VR and in general C# game dev. I will be exploring how to optimization of building planets, and other unique features.

Starting out:
Create a new project in URP and download these assets from the asset store

Adding the Sun and fixing Render Pipeline Issues

Vast Outer Space→ Prefabs → Regular Planets → Sun (Drag it to Hierarchy) | It’s pink, let’s fix it.
Vast Outer Space→ Materials (Select all Materials) | Then go to Edit → Render Pipeline → Upgrade Selected Materials to UniversalRP Materials

Making Earths Texture

I decided to import all the textures from the different planets and customized them so the planets would look more realistic. You can use the Vast Planet prefabs if you want or go to Materials under Solar System from my Github.

Add 3D Object → Sphere
Adjust it slightly so you can see it ( Adjust the transform position → (0,0,20)
To make the Material do the following: Base Map = Day Map | Normal Map = Normal Map | Metallic Map = Specular Map | add a Texture by making new material and adding the following above
Adjust the earth to be 1, the sun is 20x bigger
Turn off fog

Isometric Vs Perspective

When designing use Perspective and use Isometric when moving objects

Spinning Earth & Planets — Not realistic (Simple)

Adding Spin to Earth — will use this for other planets so made it a bit general…this will get a bit more complicated.
Add the script to Earth and then add the planet to the object “Planet” field. Press play (this should work)
First I added an Empty Game Object → Renamed it Planets → then added all the planets that I had made using the custom prefabs that were edited from the Vast Outer Space Prefabs → added the Spin Object Script and added the Planets Game Object which is now the parent of all my Planets.
Now you have the planets rotating in their respective space and also spinning around the sun.

Now because I don’t want to fill out speed on all planets and I want to randomize how quickly my planets rotate around the sun. I made a couple of adjustments to further utilized my Planets Empty gameObject.

I attached SpinObject( spin around the sun) and Orbit Spin Object (Unique planet spin)
Removed SpinObject from all planets it’s no longer necessary
Updated SpinObject
OrbitaSpinObject made an array for speeds and planets so I won’t have to attach it to each planet if I wanted to add more.
Result | Last addition is the random position for planets… I will fix it later to make it a bit more realistic.
Random Position — I added this to all the planets, will adjust it further later for individualism and other factors.

Spaceship

Drag and Drop into the Scene
Base = Base Map| Emissive = Emissive Map| Metallic = Metallic Map |Mixed AO = Occlusion Map | Roughness = Not avalible
Highlight all under the spaceship ‘Xian Texture’ and then change the material to whatever new material you made. One last thing, add an empty game object ‘SpaceShip’ and put the Xian_Texture as a child.
Use the child of SpaceShip when you want to scale down, SpaceShip will also house the RidgidBody
Make sure to add a couple of colliders, these can be capsules, boxes, etc. Use an empty as the place holder for them.
Adding movement to SpaceShip / Testing Collider
Using force to navigate, it will allow for momentum to build up. || Additional Spaceship Movements, make sure to make a new script and attach it to SpaceShip. Still need to Rotate and add Torque.

Add a Camera so you can follow the SpaceShip — CineMachine

Things to do:

  • SpaceShip Movement (Rotation and Torque).
  • Adding lasers to SpaceShip.
  • Alternative Spaceship for exploration of planets.
  • Procedural Planets. | Adding Atmosphere, buildings, aliens, etc |
  • UI and Sound.
  • Adding VR components or AR Components. (Depending on a parallel project which is for a showcase)
Preview

If you want to know more about me, feel free to connect with me on LinkedIn

--

--