Game Development Reference
In-Depth Information
I cannot overstate the importance of using the 'Log function when
building code. It will save you an enormous amount of frustration,
especially when debugging, as you will know immediately whether or not
your code you're looking at had ever been called.
We place this in our PostBeginPlay() method as it will be one of
the first things executed before a class is fully initialized. The super.
PostBeginPlay() method above our 'Log function indicates that we
want our parent class' PostBeginPlay method to be called first, then
execute ours, wherein our parent class is Camera .
Now we've got to build the meat and potatoes of our class with our
UpdateViewTarget method, as well as declare our local variables that we'll be using:
Query ViewTarget and outputs Point Of View.
* @param OutVT ViewTarget to use.
* @param DeltaTime Delta Time since last camera
update in seconds
(out TViewTargetOutVT, float DeltaTime)
local Pawn Pawn;
local Vector V, PotentialCameraLocation, HitLocation,
local Actor HitActor;
The next if statement is used for blending what the camera sees as we begin to
move around:
/** If there is an interpolation, don't update outgoing
viewtarget */
if (PendingViewTarget.Target!=None&&
Pawn refers to our game pawn. We'll have a number of vectors to define,
but it is simple if we break it down:
The first one, V , is simply a placeholder and of no use to us. The
GetActorEyesViewPoint method required a vector as one of its
parameters and we had to put something in there, so we used V . When
a vector's properties are not defined it simply defaults to X=0, Y=0, Z=0.
Search Nedrilad ::

Custom Search