111 target(0), subtarget(0), other(0), distance(0.0), evade_time(0),
112 objective(0.0f, 0.0f, 0.0f)
117 for (
int i = 0; i < 3; i++)
168 static char name[64];
169 sprintf_s(name,
"SteerAI(%s)",
self->
Name());
182 return self->Velocity();
185 return Point(1, 0, 0);
191 if (!
self || !
target)
return;
225 Point self_dest =
self->Location() + cv * time;
240 Point obj_t = pt -
self->Location();
244 double az =
self->FlightPathYawAngle();
245 double el =
self->FlightPathPitchAngle();
247 const double MAX_ANGLE = 15*
DEGREES;
248 const double MIN_ANGLE = 3*
DEGREES;
252 else if (az < -MAX_ANGLE)
254 else if (az > MIN_ANGLE)
255 az = MIN_ANGLE + (az-MIN_ANGLE)/2;
256 else if (az < -MIN_ANGLE)
257 az = -MIN_ANGLE + (az+MIN_ANGLE)/2;
261 else if (el < -MAX_ANGLE)
263 else if (el > MIN_ANGLE)
264 el = MIN_ANGLE + (el-MIN_ANGLE)/2;
265 else if (el < -MIN_ANGLE)
266 el = -MIN_ANGLE + (el+MIN_ANGLE)/2;
273 result =
Point(obj_t * cam.vrt(),
292 Point obj_t = pt -
self->Location();
350 if (point.
z > 0.0f) {
354 if (point.
x < 0)
az[0] = -
az[0];
355 if (point.
y > 0)
el[0] = -
el[0];
358 s.
pitch =
el[0] - seek_damp * (
el[1] +
el[2] * 0.5);
363 if (point.
x > 0) s.
yaw = 1.0f;
366 s.
pitch = -point.
y * 0.5f;
385 if (point.
z > 0.0f) {
386 if (point.
x > 0) s.
yaw = -1.0f;
407 double ax = radius - fabs(point.
x);
408 double ay = radius - fabs(point.
y);
413 if (point.
x > 0) s.
yaw = -s.
yaw;
436 int direction = (rand()>>9) & 0x07;
440 case 0: evade.
yaw = 0; evade.
pitch = -0.5;
break;
441 case 1: evade.
yaw = 0; evade.
pitch = -1.0;
break;
442 case 2: evade.
yaw = 1; evade.
pitch = -0.3;
break;
443 case 3: evade.
yaw = 1; evade.
pitch = -0.6;
break;
444 case 4: evade.
yaw = 1; evade.
pitch = -1.0;
break;
445 case 5: evade.
yaw = -1; evade.
pitch = -0.3;
break;
446 case 6: evade.
yaw = -1; evade.
pitch = -0.6;
break;
447 case 7: evade.
yaw = -1; evade.
pitch = -1.0;
break;