Game Development Reference
In-Depth Information
One important note to mention before moving to the code. We must remember to somehow
“lock” the vertical rotation of the camera towards up and down. This means that we set a
maximum angle between the camera front vector and the horizon (60 degrees for example),
in order to prevent the camera from rotating 180 degrees and hence becoming up side
down. Back to our human body example, you see that the rotation of the human head is
limited.
To implement the first person input system, we will use a script called FirstPersonControl,
which is shown in Listing 9. This script must be attached to the cylinder, which in turn has
the camera as a child as shown in Illustration 21.
Search WWH ::




Custom Search