Presentation on game objects and components using a Unity project that examples transforms, camera, lights, terrain, trees, sprites.

I have created a simple scene in Unity that demonstrates transforms, camera, lights, terrain, trees, and sprites. Game objects are the items that make up a scene in Unity. Game objects are made up of a number of components (for example, a transform component). A roller ball player can explore a mountainous terrain while the environment dynamically changes to create the effect of passing days. The sun, stars, and moon rotate on their own axis, independent of other game objects. The clouds also rotate around the terrain to create a realistic effect. The texture of the skybox (the inverted half-sphere) changes with each frame.

Transforms: All objects have a transform that stores the values of the object’s position, rotation and scale. The transform can have a parent and the values of the object’s position, rotation, and scale are calculated relative to its parent’s transform. If the transform has no parent, is it calculated in relation to the world of the game space. In my scene, each game object has a component containing a transform. For example, I attached a script to the Sun game object that increases its X rotation by a certain value each frame, and this is set in Unity. This creates the effect of a sun rising, travelling through the sky, and setting. I attached the same script to the Moon game object, but I have a Boolean value that can be set to true in Unity. If it is set to true, the Moon’s Y rotation increases by a certain value set in Unity at each frame.

Camera: A Camera is a device through which the player views the world. A screen space point is defined in pixels. The camera displays the content to the player. Each scene has to have at least one camera. In my scene, the game view camera is attached to the player game object in a camera controller script.

Terrain: The Terrain component renders the terrain. Terrain objects are added from the Terrain menu, where terrains can be painted over a flat plane. For example, you can raise or lower terrain, add texture by importing textures and painting the terrain using brushes, and add trees by importing tree prefabs and placing them on the terrain. In my scene, the terrain has mountains and trees, and I have painted the terrain with a grass texture and the mountains with a rocky texture.

Light: Lights are needed in a game since they determine how objects will be shaded and how shadows will be cast in the game. Lights are essential for adding colour to the game and setting a certain look to the environment. In my scene, both the moon and sun have directional light components that have different intensities. This allows for a realistic shadow to be cast over the terrain and create realistic shadows, especially as the sun sets and the moon rises.

Trees: Trees can be placed on terrains. Trees are 3D objects. Tree assets can be imported into the game with different heights and densities. There is a mass tree button or covering the entire terrain. Trees can bend with the wind when you create a wind zone.

Sprites: Sprites are 2D objects or in 3D games they are textures. The sprite renderer allows images to be displayed as sprites in the scene. In a 3D space, the way the object is displayed is affected by the object’s lighting and the position. In my scene, I have used 2D sprites as stars. I have attached a script to the stars that enables and disables the star object’s renderers creating a blinking effect in the sky.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s