Game Development Reference
How it works...
There was no need to reference our CameraProperties archetype in this example,
as we've hardcoded our values based on what worked with our easy tutorial camera.
To start things off, we needed our player controller to use our side-scrolling camera,
so we made the appropriate change in our default properties block. We also had to make
a few changes to the PlayerController class. Specifically, we wanted our pawn to only
be able to move forward and back, thereby removing the ability to strafe left and right.
Moreover, our system requires that the right side of the screen is always considered forward.
We also had to override the GetBaseAimRotation function in our pawn class and
GetAdjustedAimFor function in our player controller class. These changes tell the
game to use the direction the pawn is facing for firing shots, and not the camera's.
Other than the player controller though, the code is nearly identical to what we had in
our FirstPersonCam class, except for the hardcoded values declared in our default
properties block, which are now adjusted to work for a side-scrolling view.
Don't forget to go back to TutorialGame.uc and change your default properties so that
the game is using our new TutorialPlayerControllerSSC class, and not our old
Creating a top-down camera
The top-down camera is popular with RTS games or shooters, as it offers a perspective that
allows players to easily see approaching enemies. With our top-down camera we'll have our
pitch locked, so that the player cannot look up or down, and therefore also locks the camera
from being raised or lowered.
We will still allow the player to freely yaw left and right, and therefore rotate around the world,
although the camera will follow the pawn from a fixed perspective.
We'll be hardcoding our values again. Much of what you'll see next is similar to the code
found in the side-scrolling camera code. We'll be using another custom player controller
as well, which is only marginally different from that of the side-scroller's.
For this purpose, we will want to create a new player controller class, called
Just as we did with the third person camera, we'll want the first person weapon mesh
to remain hidden, and continue to expose the third person weapon and pawn meshes
to the camera.