Game Development Reference
In-Depth Information
58.
speed.y = speed.y - gravity * Time.deltaTime;
59.
} else {
60.
speed.y = 0;
61.
Vector3 newPosition = transform.position;
62.
newPosition.y = 2.0f;
63.
transform.position = newPosition;
64.
}
65.
66.
}
67.}
Listing 10: Reading movement input for third person input
We have discussed all these functions in the previous two sections, specifically in Listing
6 in page 26, and Listing 9 in page 40. Notice that this system is similar to the first person
input system, except for reading mouse input and moving and rotating the camera. Cam-
era rotation is the responsibility of ThirdPersonCamera script that we are going to attach to
the camera. Listing 11 shows this script.
Search WWH ::




Custom Search