UnrealScript Game Programming Cookbook

(Chris Devlin) #1
Chapter 3

85

/*socket not found, use the other way of updating vectors /
if(Pawn.Mesh.GetSocketWorldLocationAndRotation
('WeaponPoint', OutVT.POV.Location,
OutVT.POV.Rotation)==false)
{
/* Start the cam location from the target eye view
point
/
OutVT.Target.GetActorEyesViewPoint
(OutVT.POV.Location, OutVT.POV.Rotation);
}


/* Force the camera to use the target's rotation /
OutVT.Target.GetActorEyesViewPoint
(V, OutVT.POV.Rotation);


/* Add the camera offset /
OutVT.POV.Rotation+=CamOffsetRotation;


/* Math for the potential camera location /
PotentialCameraLocation=OutVT.POV.Location
+(CamOffset>>OutVT.POV.Rotation);


/* Draw a trace to see if the potential camera
location will work
/
HitActor=Trace(HitLocation, HitNormal,
PotentialCameraLocation, OutVT.POV.Location, true,,,
TRACEFLAG_BULLET);


/* Will the trace hit world geometry? If so then use
the hit location and offset it by the hit normal
/


if (HitActor!=None&&HitActor.bWorldGeometry)
{
OutVT.POV.Location=HitLocation+HitNormal*16.f;
}
else
{
OutVT.POV.Location=PotentialCameraLocation;
}
}
}


Our default properties are the only changes to this class, when compared to the
side-scroller's. I found these values by using the tutorial camera and adjusting
the values with the archetype until I found what I deemed to be appropriate.

Free download pdf