Вы находитесь на странице: 1из 2

//Third-person camera

simulated event GetPlayerViewPoint(out vector POVLocation, out Rotator POVRotati


on)
{
local MFPawn P;
local rotator rot;
local vector vHeadOffset, vAimingOffset;
local float scale;
if(ViewTarget != none)
{
P = MFPawn(ViewTarget);
if(!IsInState('Dead') && !IsInState('RoundEnded') && P != none &
& P.IsLocallyControlled())
{
if(IsInState('Spectating'))
{
rot = P.Rotation;
rot.Pitch = P.RemoteViewPitch << 8;
Look = vector(rot);
}
vHeadOffset.Z = P.HeadOffset;
LastViewLoc = P.Location + vHeadOffset;
scale = 1;
if(abs(Look.X) < TurningThreshold)
scale += abs(Look.X) / TurningThreshold - 1;
if(Look.X < 0)
scale *= -1;
vAimingOffset.X = LookingOffset * scale;
vAimingOffset.Z = LookingOffset * scale;
//Ducking
if(BeganDucking != 0)
scale = fmin(WorldInfo.TimeSeconds - BeganDuckin
g, DuckTransitionTime) / DuckTransitionTime;
else
scale = 1 - fmin(WorldInfo.TimeSeconds - Stopped
Ducking, DuckTransitionTime) / DuckTransitionTime;
vAimingOffset.Z += P.EyeHeight - P.default.EyeHeight + L
ookingOffset * Look.Z * scale;
LastViewLoc.Y = 0;
POVLocation = LastViewLoc + vAimingOffset + CameraOffset
;
}
else
{
if(!ViewTarget.IsA('UTGib'))
LastViewLoc = ViewTarget.Location;
if(ViewTarget == self)
{
if(LastViewLoc.Y == 0)
{
LastViewLoc += CameraOffset * 2;
SetLocation(LastViewLoc);
}
bCollideWorld = true;
POVLocation = LastViewLoc;
LastViewLoc -= CameraOffset * 2;
}
else
{
LastViewLoc.Y = 0;
POVLocation = LastViewLoc + CameraOffset;
}
}
}
else
POVLocation = LastViewLoc + CameraOffset;
POVRotation = rotator(-CameraOffset);
StopViewShaking();
if(CameraEffect != none)
CameraEffect.UpdateLocation(POVLocation, POVRotation, GetFOVAngl
e());
}

Вам также может понравиться