UnrealScript Game Programming Cookbook

(Chris Devlin) #1

Scripting a Camera System


84


  1. Now add our functions as shown in the following code snippet:
    /*****

    • Query ViewTarget and outputs Point Of View.

    • @paramOutVTViewTarget to use.

    • @paramDeltaTime Delta Time since last camera update (in
      seconds)
      *****/
      functionUpdateViewTarget
      (outTViewTargetOutVT,floatDeltaTime)
      {
      local Pawn Pawn;
      local Vector V, PotentialCameraLocation, HitLocation,
      HitNormal;
      localActor HitActor;




/** UpdateViewTarget for the camera class we're extending
from */
Super.UpdateViewTarget(OutVT, DeltaTime);

/** If there is an interpolation, don't update outgoing
viewtarget */
if (PendingViewTarget.Target!=None&&OutVT==
ViewTarget&&BlendParams.bLockOutgoing)
{
return;
}

Pawn = Pawn(OutVT.Target);
if (Pawn != None)
{
/** Hide the pawn's "extra" weapon */
if(Pawn.Weapon!=none)
{
Pawn.Weapon.SetHidden(true);
}
/*****************************************************************
* If you know the name of the bone socket you want to use,
then
* replace 'WeaponPoint' with yours.
* Otherwise, just use the Pawn's eye view point as your
starting
* point.
*****************************************************************/
Free download pdf