Game Development Reference
In-Depth Information
First of all remember that we are dealing with a camera that is independent of the car
object, unlike third person camera, which was a child of the player character. Therefore
we declare the variable car , in order to reference the car object, just like we have done in
platformer input system (see Illustration 19 in page 31). Additionally, we have height , which
is the vertical distance between the y position of the car and the y position of the camera.
Finally, we have zDistance , which tells us how many meters there are between the car and
the camera.
To control camera rotation we declare turnTimeout , which is the time the camera waits after
the car turns, and before the camera starts to rotate behind it. As for turnSpeed , we are going
to use it to determine the speed of camera rotation. Finally, we have angleChangeTime ,
which stores the time which the angle between the front vector of the car and the look
direction of the camera becomes more than one degree. We need to store this time in order
to compute the time passed since the angle change, and hence start to rotate the camera
when this time exceeds turnTimeout . This is going to be discussed in detail shortly.
Search WWH ::




Custom Search