Graphics Reference
In-Depth Information
4.6.1 Third-Person Camera
A third-person camera sits behind the player. It is not quite the same as a follow camera;
a third-person camera usually orbits around the player rather than simply following it
around. To visualize this, imagine that the camera is tied to a pole attached to the target
player. As the player moves around, the camera remains to be the length of the pole away
from it but the camera is free to move around the player in a circle (see Figure 4.1).
The position of the camera is usually somewhere behind the player, with a little damp-
ing on its horizontal movement applied to it, to allow for a good sense of movement when
the player turns. In some third-person camera setups, the camera may be allowed to move
in or out from the target player some. In some setups, the camera may also be offset from
the player a little (e.g., in the Microsoft Studios game Gears of War , the camera is positioned
over the right shoulder of the player rather than directly behind).
Below is the Camera_Third_Person.cs script:
public class Camera_Third_Person : BaseCameraController
{
public Transform myTransform;
public Transform target;
public float distance = 20.0f;
public float height = 5.0f;
public float heightDamping = 2.0f;
public float lookAtHeight = 0.0f;
public float rotationSnapTime = 0.3F;
public float distanceSnapTime;
public Vector3 lookAtAdjustVector;
private float usedDistance;
float wantedRotationAngle;
float wantedHeight;
Camera orbits
around the
player
Forward
Player
Figure 4.1 Behavior of a third-person camera.
 
Search WWH ::




Custom Search