Animation using Unity Engine
In the last few tutorials we have learnt how to create game objects and how to arrange them to create simple games.
In this tutorial we will be dealing with the animation/motion object. We will learn how parent object and child objects are interrelated. Alongside the game itself, Unity is also used to develop the animation (for storyline and in game action) for the game.
Solar System using Unity Engine
Our solar system comprises of 8 main planets and 1 dwarf planet (Pluto). Also we have natural satellites revolving around most of these planets. Planet Earth is the 3rd planet and it revolves around the Sun. The Moon, which is a natural satellite of planet Earth, revolves around it.
In this chapter, we will make a similar animated model of the Sun, the Earth and earth's Moon, along with some outer space scenery using an image along with a background music.
Follow this step-by-step procedure to start developing this animation.
- Open Unity 3D
- Start new Project and give your project a name. For example: mini_solar_sys
- Now, add three 3D spheres for Sun, Earth and Moon. (If you want to add other planets like mercury, venus, mars etc, you should...)
- To add spheres, go to GameObject menu → 3D object → Sphere and give them different(any)
Z scale value to arrange them as per requirement. Keep their sizes different, with the Sun being the largest, then the sphere for Earth and then the Moon,
- You can browse for textures on the internet for Sun, Moon and Earth and apply them to our game objects. You can also find these assets in the Uniy 3D asset store like this one.
- In this animation scene/model, we will have to add two types of lights, first the Spotlight for illuminating other objects from a single point, which in this case is the Sun. The other one will be the Area Light which will illuminate the whole scene, acting as the glow of the sun
- To bring these two lights into action, go to GameObject menu → Light → Spotlight
- You can adjust the intensity of the Spotlight by modifying the intensity and bounce intensity attributes.
- Adding the required textures to our spheres, will make the whole animation look more realistic, so if you haven't already added it, do it now.
- Now, it's time to give the background a dark galaxy look. Download a texture or a high quality picture, like one below.
- To cover the complete scene background, we will have to use skybox. The skybox fills the entire unity background with a texture in such a way that the entire background looks alike and similar.
- To achieve this in our animation scene, we will have to use material. Go to Project Window Pane, Assets menu → Material, name it background.
- Now select the material, and go to Inspector Pane, and choose, Shader drop down → Skybox → 6 Sided
- Click on Select → Select Texture, a window pops up, select the universe background texture from the assets and close the window.
- You will have to repeat the above step of adding texture, six times, to add this texture to all the sides of the 6 Sided Skybox → Front, Back, Left, Right, Up and Down.
- Now simply drag and drop the newly created material on to your Unity Background, you will see something like this,
In the next lesson we will continue to discuss about this and add scripts and codes which will allow us to move the planets and perform the concepts of rotation and revolution in the form of animation.
Want to learn coding and don't know where to start?
Try out our Interactive Courses for Free 🥳 😯 🤩