Game Development Reference
In-Depth Information
you selected before is ticked. This is the reason why one plane
has updated shading and the other does not. The plane without
the recalculated normal keeps the shading it started with on each
polygon because as far as the rendering system is concerned, the
angle between the light source and the normal has remained
unchanged. It is possible to move vertices around and leave the
normals where they were. In this case, the original normals are no
longer orthogonal with their polygons. The line
mesh.RecalculateNormals();
ensures that all normals are recalculated and made orthogonal to their
polygons after the polygons' vertices are moved. In this case, recalculating
the normal is essential to getting the correct lighting effect on the
surface.
2.4 Two-Dimensional Games in a 3D
Game Engine
Although 3D game engines aren't often written to support 2D game creation,
many developers use them for this purpose because (a) they are familiar
with them, (b) they don't have to purchase software licenses for other
development platforms, and (c) the engines provide support for multiple
platforms and game types. As is the case with Unity, although it is not strictly a
2D game development environment, it can port to Android and iOS, making it
attractive to developers. In addition, mechanics that are relevant in 3D games
are equally so in 2D games.
To create a 2D game in a 3D environment, the one degree of freedom is
removed. In the case of the following hands-on section, the y axis is all but
ignored and the camera is placed into orthographic mode looking down
on the scene as though it were playing out on the top of a table.
Unity Hands On
A 2D Vector-Based Space Shoot 'em Up
Step 1. Download Chapter Two/Basic2DGameStarter.zip from the Web
site, unzip, and open in Unity. In the Project, double-click on basicgame of
the Scenes folder to open the scene. The Scene will appear with a planet
and gun turret in the middle and a rocket ship to the lower left. The
artwork used here is freely available from http://www.openclipart.org/ .
Step 2. Press play. Nothing will happen, but you will notice that you
can click on the Quit button and go back and forward between the
game screen and the main menu. A fuller version of the game will be
created as you proceed through this topic.
Search Nedrilad ::




Custom Search