Game Development Reference
In-Depth Information
5.
This part is slightly different from what we've seen before. Rather than offer
the option of choosing to use the target's rotation or not, we're just declaring
that we will indeed use the target's (pawn's) 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;
}
6. Our hardcoded values for our camera's offset and rotation will be defined in the class'
default properties, CamOffsetRotation=(Pitch=16384, Roll=0, Yaw=0) ,
which is the Unreal unity equivalent to 90 degrees.
/** Hardcoded vector & rotator values for our camera */
defaultproperties
{
CamOffset=(x=+10,y=0,z=0)
CamOffsetRotation=(Pitch=0, Roll=0, Yaw=0)
}
 
Search Nedrilad ::




Custom Search