UnrealScript Game Programming Cookbook

(Chris Devlin) #1

Scripting a Camera System


74


  1. Where the magic happens is in the default properties. We're shifting the camera
    so that it gives us the third person view we're looking for:
    /* Hardcoded vector & rotator values for our camera /
    defaultproperties
    {
    CamOffset=(x=-100,y=15,z=20)
    CamOffsetRotation=(Pitch=-2048)
    }


You may notice that we don't have values for Roll and Yaw. That's because
any values which aren't declared in a Rotator are assumed to be zero.

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 third person camera,
so we made the appropriate change in our default properties block.


For the most part, 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 third person view.

Free download pdf