Game Development Reference
In-Depth Information
Immediately after that, we do a trace to see if our missile can hit the target, and
check for anything that may be in the way. If we determine that we can't hit our
target then it's time to start looking for a new one.
else
{
// Trace the shot to see if it hits anyone
Instigator.Controller.GetPlayerViewPoint
( StartTrace, AimRot );
Aim = vector(AimRot);
// Where our trace stops
EndTrace = StartTrace + Aim * LockRange;
HitActor = Trace
(HitLocation, HitNormal, EndTrace, StartTrace,
true,,, TRACEFLAG_Bullet);
// Check for a hit
if((HitActor == None)||!CanLockOnTo(HitActor) )
{
/** We didn't hit a valid target? Controller
attempts to pick a good target */
BestAim = ((UDKPlayerController
(Instigator.Controller)!=None)&&
UDKPlayerController(Instigator.Controller).
bConsolePlayer) ? ConsoleLockAim : LockAim;
BestDist = 0.0;
TA = Instigator.Controller.PickTarget
(class'Pawn', BestAim, BestDist, Aim, StartTrace,
LockRange);
if ( TA != None && CanLockOnTo(TA) )
{
/** Best target is the target we've locked */
BestTarget = TA;
}
}
// We hit a valid target
else
{
// Best Target is the one we've done a trace on
BestTarget = HitActor;
}
}
 
Search Nedrilad ::




Custom Search