Game Development Reference
In-Depth Information
in a vector that points downwards, hence has a negative value of y . Th s value is stored in
resultDirection variable to be used later for determining the direction of camera rotation.
In lines 74 through 79, we determine the direction of camera rotation based on the value of
resultDirection . If resultDirection is negative, left-hand rule tells us that rotation direction
must be counter-clockwise, hence negative. Remember, however, that the front vector of
the car is what we must rotate counter- clockwise, but we have no control over the car in this
script. Therefore, a counter-clockwise rotation of the car can be substituted by a clockwise
rotation of the camera. For that reason, you see that rotationDirection always has the oppos-
ite sign of resultDirection . Finally, we perform the rotation in lines 83 through 85 based
on our computations. The final result can be seen in scene7 in the accompanying project.
Search WWH ::




Custom Search