Game Development Reference
In-Depth Information
You will learn in this section how to implement this type of input systems. We will benefit
from a number of techniques we have learned so far, such as reading keyboard and mouse
input, relations between objects, and rotation functions such as transform.RotateArount() .
There are various methods that can relate the rotation of the camera to movement of the
character. In World of Warcraft , for example, the mouse is used mainly to interact with
the objects in the environment. Therefore, character rotation is performed using keyboard
input, and camera rotation uses the right mouse button. In other games, such as Hitman ,
mouse pointer is used for aiming, so the character looks always at the position of the mouse
pointer, and shooting is performed in that direction. In this latter case, the camera rotates
automatically to follow the direction where the character looks.
In this section, we are going to deal with a simple system that rotates the character based on
horizontal movement of the camera, in a manner similar to the one used in previous sec-
tion for first person input system. We will also move the camera up and down based on vertic-
al mouse movement. It is important to keep the camera always look at the character and follow
it wherever it moves. We are going to implement this by using object relations between the
character and the camera. Finally, we are going to allow the player to zoom the camera in and
out using the mouse wheel. Let's begin by creating a simple character using basic shapes, it
might look like the character in Illustration 23.
Search WWH ::




Custom Search