Here is some code I took from the tick function of the RocketLauncher, and used it in a vehicle-mounted weapon. This is the code that makes the rocket launcher "lock on" to a player. Eventually"Other" is passed to the projectile that this weapon fires so it can home in on the target. It all seems to be working (the projectiles track and follow the target), except that it seems one does not have to have the crosshairs ON the target for it to be locked on to, and sometimes it won't lock on if the crosshairs ARE on the target.
My problem is that I don't quite see how this works, even after checking out the PickTarget function in Controller.
Can someone explain how this works so I can make whatever adjustments I need it would be appreciated. Thanks.
Code:
StartTrace = Instigator.Location + Instigator.EyePosition(); Aim = Instigator.GetViewRotation(); BestAim = LockAim; Other = Instigator.Controller.PickTarget(BestAim, BestDist, Vector(Aim), StartTrace, SeekRange);
Code:
native(531) final function pawn PickTarget(out float bestAim, out float bestDist, vector FireDir, vector projStart, float MaxRange);
Comment