mirror of
https://github.com/ineedbots/iw4_bot_warfare.git
synced 2025-03-16 07:56:56 +00:00
Improved aiming
This commit is contained in:
parent
c2c7b94c79
commit
7a0dc3b7f9
@ -1394,7 +1394,7 @@ aim()
|
||||
if (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
|
||||
{
|
||||
@ -2327,7 +2327,7 @@ botMoveTo(where)
|
||||
/*
|
||||
Bots will look at the pos
|
||||
*/
|
||||
bot_lookat(pos, time)
|
||||
bot_lookat(pos, time, vel)
|
||||
{
|
||||
self notify("bots_aim_overlap");
|
||||
self endon("bots_aim_overlap");
|
||||
@ -2342,12 +2342,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 GetEye(); // 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 GetEye()) - anglesToForward(myAngle) );
|
||||
angles = VectorToAngles( (pos - myEye) - anglesToForward(myAngle) );
|
||||
|
||||
X=(angles[0]-myAngle[0]);
|
||||
while(X > 170.0)
|
||||
@ -2361,7 +2372,6 @@ bot_lookat(pos, time)
|
||||
Y=Y-360.0;
|
||||
while(Y < -180.0)
|
||||
Y=Y+360.0;
|
||||
|
||||
Y=Y/steps;
|
||||
|
||||
for(i=0;i<steps;i++)
|
||||
|
Loading…
x
Reference in New Issue
Block a user