Game Development Reference
In-Depth Information
The 2D world of Unity
Unity is, of course, a 3D game engine. The first thing one must understand to build
a 2D video game in Unity is how exactly to treat the engine. Sure, you may know
how to treat the engine right to get a gorgeous tomb-raiding game out of it, but do
you know how to make a gorgeous side-scrolling platformer? The same techniques
you used for the tomb game will be used here as well; however, your way of
thinking needs to be slightly adjusted.
The perspective camera
If you have ever done any work with the camera in Unity, then you may have
noticed that it has two projection modes— Perspective and Orthographic . Both
have their uses. And I bet you are sitting there thinking, "Orthographic. Totally.
We're using that."
If that's what you said, you'd be correct! However, before Unity 4.3, it would have
some drawbacks. But we aren't holding anything against you, so here's a cookie
(cookie sold separately). For everyone who doesn't know the difference, it's actually
quite simple. A perspective camera (on the right in the following image) is Unity's
default camera. It shows the scene the way it actually is, just like our eyes see things.
Orthographic (on the left in the following image), on the other hand, completely
removes depth. So, no matter how far an object is from the camera, it looks like it's
right there. Everything parallel remains parallel to the camera. An orthographic
camera simply renders an object, or it doesn't. However, the Z order of objects is
maintained. In older versions of Unity, a perspective camera would have done
a great job as it would give automatic parallax support, but more about that later.
 
Search WWH ::




Custom Search