Game Development Reference
A reference to the Camera class is being held in the PlayerController class, as
well as the Pawn class being controlled. The input from the player is received from the
PlayerController class and used to update the positions and rotation of the pawn
it is controlling. The Camera class passes its update to the Pawn class, which in turn
updates the rotation and position back to the camera.
By altering one or more of these classes and the way they interact, the player's camera can
be set to show the world to the player using any perspective. By default, the player's camera
uses a first-person perspective with the option to toggle it to a third-person over-the-shoulder
perspective. We're going to create our own camera system which will allow us to do all of that,
A player's view into the world is determined by the Camera class. The camera's rotation
and position determines the viewpoint from which the scene is rendered when displayed
on screen. Additionally, the Camera class holds properties for controlling the way the world
is seen, such as setting the aspect ratio, field of view, and so on.
Cameras also have special effects that can be applied to the Camera class, thus allowing
things such as post processing, camera animations, lens effects, and camera modifiers. While
we won't discuss those special effects here, I, at least, wanted to bring them to your attention.
The PlayerController class
Responsibility for translating player input into game actions, such as moving a pawn or
controlling the camera, is passed off to the PlayerController class. It's not unusual for
the player controller's rotation to drive the camera rotation, although there are other ways to
handle this, such as having our target pawn implement CalcCamera . We will not be taking
that approach, however. There are some negatives associated with this path, including the
loss of some functionality, such as camera animations and post processing effects.