mirror of
https://github.com/ineedbots/t4_bot_warfare.git
synced 2025-04-22 07:55:43 +00:00
Improved bot aimming
This commit is contained in:
parent
e3253d291a
commit
8d108b0fc5
@ -1295,7 +1295,7 @@ aim()
|
||||
if(!nadeAimOffset && conedot > 0.999 && lengthsquared(aimoffset) < 0.05)
|
||||
self thread bot_lookat(aimpos, 0.05);
|
||||
else
|
||||
self thread bot_lookat(aimpos, aimspeed);
|
||||
self thread bot_lookat(aimpos, aimspeed, target getVelocity());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2195,12 +2195,23 @@ bot_lookat(pos, time)
|
||||
if (!isDefined(pos))
|
||||
return;
|
||||
|
||||
steps = time / 0.05;
|
||||
if (!isDefined(steps) || steps <= 0)
|
||||
if (!isDefined(time))
|
||||
time = 0.05;
|
||||
|
||||
if (!isDefined(vel))
|
||||
vel = (0, 0, 0);
|
||||
|
||||
steps = int(time * 20);
|
||||
if (steps < 1)
|
||||
steps = 1;
|
||||
|
||||
myEye = self GetEyePos(); // get our eye pos
|
||||
myEye += (self getVelocity() * 0.05) * (steps - 1); // account for our velocity
|
||||
|
||||
pos += (vel * 0.05) * (steps - 1); // add the velocity vector
|
||||
|
||||
myAngle=self getPlayerAngles();
|
||||
angles = VectorToAngles( (pos - self GetEyePos()) - anglesToForward(myAngle) );
|
||||
angles = VectorToAngles( (pos - myEye) - anglesToForward(myAngle) );
|
||||
|
||||
X=(angles[0]-myAngle[0]);
|
||||
while(X > 170.0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user