Game Development Reference
In-Depth Information
Creating a first person camera
While a first person camera comes standard with UDK, we've crafted a camera system
that is modular, and allows us to easily adjust our perspective while still avoiding clipping
through objects.
We'll take all that we've learned from our previous lessons and apply it to this one. We'll be
hardcoding a first person camera, based on the property values I've found to be consistent
with what we are looking for.
Getting ready
Our next few lessons will all require one similar change, all of which will occur with
TutorialPlayerCotroller class. Under defaultproperties , we'll need to
change the following:
CameraClass = Class'Name_Of_Camera_Class'
So, for this tutorial it should read as follows:
CameraClass = Class'FirstPersonCam'
With this completed, our player controller will now ignore any change we make to the
CameraProperties archetype we've created and instead use the values we write in
FirstPersonCam.uc .
Moreover, our new camera system will look very similar to our tutorial camera, so I won't
go over everything again in much detail.
Rather than rely on the values we've entered in our archetype, our camera will now be built
around hardcoded numbers which we've deemed to best suit our needs. Of course, you could
alter them at any time through code.
How to do it...
UDK comes with a first person camera right out of the box, but we want to create one that fits
in with our modular camera system. We'll be creating a new class, which is very similar to our
previous camera class in many aspects. Additionally, we'll need to bind this new camera class
to our player controller so that we can actually utilize it, which is explained as follows:
1.
We'll start by creating a new class called FirstPersonCam , extending from Camera ,
just as we did with our previous camera system.
class FirstPersonCam extends Camera;
 
Search Nedrilad ::




Custom Search