UnrealScript Game Programming Cookbook

(Chris Devlin) #1
Chapter 3

55

When creating new camera perspectives, it may be necessary to update or override some
functionality within the PlayerController class, as the player's input is translated into the
orientation and the movement of the pawn can differ with each type of camera and perspective.


Now how exactly does this tie into the pawn? The player's physical representation in the
world is not only handled by the pawn, but it can also be responsible for controlling the
position and rotation of the player's camera. By overriding certain functions, you can create
new camera perspectives. This is exactly what we're going to do with our Camera and
PlayerController classes.


Configuring the engine and editor for a custom camera


All of our recipes will require a new custom GametTypegametype class to tell UDK to use our
new Pawn and PlayerController classes.


Getting ready


We'll be using the same game type and player controller for all of these cameras, so we'll
begin this chapter's recipes by explaining them here. Begin this lesson by extending our
game from UTGame:


class TutorialGame extends UTGame;

defaultproperties
{
PlayerControllerClass=class'Tutorial.TutorialPlayerController'
DefaultPawnClass=class'Tutorial.TutorialPawn'
DefaultInventory(0)=class'UTWeap_ShockRifle'
}

We set the default properties which include our new custom TutorialPlayerController
class and TutorialPawn class. I choose to use UTWeap_ShockRifle as my weapon of
choice, but you can place whatever you'd like here.


We'll need to modify the DefaultGameEngine.ini and DefaultGame.ini files as well, to
tell the editor and engine to use the new game type as the default. These files can be found in
your directory under the path, UDKGame/Config.


DefaultGameEngine.ini

[UnrealEd.EditorEngine]
+EditPackages=UTGame
+EditPackages=UTGameContent
Free download pdf