Game Development Reference
I've included a reference as well, to give you a better understanding of
how the Unreal Engine converts degree rotations into Unreal rotator units.
I've also added 10 to our x value, because if we don't, then we're able to
see the back of the gun's model.
So, if we wanted our pitch to be turned up 90 degrees, we would write,
CamOffsetRotation=(Pitch=16384, Roll=0, Yaw=0) .
With our class completed, all you need to do is compile the project, launch the editor,
and you'll have a first person camera!
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 first person camera,
so we made the appropriate change in our default properties block.
Our FirstPersonCam extends our Camera class, and allows for more freedom down
the road, as opposed to using CalcCamera . While our method requires a bit more work,
we are now free to use camera animations and post processing effects.
For the most part, the code is very similar to what we had in our TutorialCamera class,
but instead of variables for things like camera offset and rotation being read from our
CameraProperties archetype, we are hardcoding them in the default properties block
of our FirstPersonCam class.