// traces multiple trajectories to find one that will impact the target
// 'end' vector is the place it aims for,
// traces multiple trajectories to find one that will impact the target
// 'end' vector is the place it aims for,
{
float dist, delta_t, blend;
vector desiredang, diffang;
{
float dist, delta_t, blend;
vector desiredang, diffang;
//dprint("aim ", this.netname, ": old:", vtos(this.v_angle));
// make sure v_angle is sane first
this.v_angle_y = this.v_angle.y - floor(this.v_angle.y / 360) * 360;
this.v_angle_z = 0;
//dprint("aim ", this.netname, ": old:", vtos(this.v_angle));
// make sure v_angle is sane first
this.v_angle_y = this.v_angle.y - floor(this.v_angle.y / 360) * 360;
this.v_angle_z = 0;
// get the desired angles to aim at
//dprint(" at:", vtos(v));
v = normalize(v);
// get the desired angles to aim at
//dprint(" at:", vtos(v));
v = normalize(v);
//dprint(ftos(maxfiredeviation),"\n");
//dprint(" diff:", vtos(diffang), "\n");
//dprint(ftos(maxfiredeviation),"\n");
//dprint(" diff:", vtos(diffang), "\n");
}
vector bot_shotlead(vector targorigin, vector targvelocity, float shotspeed, float shotdelay)
}
vector bot_shotlead(vector targorigin, vector targvelocity, float shotspeed, float shotdelay)
bool bot_aim(entity this, .entity weaponentity, float shotspeed, float shotspeedupward, float maxshottime, bool applygravity)
{
bool bot_aim(entity this, .entity weaponentity, float shotspeed, float shotspeedupward, float maxshottime, bool applygravity)
{
//dprint("AIM: ");dprint(vtos(this.bot_aimtargorigin));dprint(" + ");dprint(vtos(this.bot_aimtargvelocity));dprint(" * ");dprint(ftos(this.bot_aimlatency + vlen(this.bot_aimtargorigin - shotorg) / shotspeed));dprint(" = ");dprint(vtos(v));dprint(" : aimdir = ");dprint(vtos(normalize(v - shotorg)));dprint(" : ");dprint(vtos(shotdir));dprint("\n");
//traceline(shotorg, shotorg + shotdir * 10000, false, this);
//if (trace_ent.takedamage)
//dprint("AIM: ");dprint(vtos(this.bot_aimtargorigin));dprint(" + ");dprint(vtos(this.bot_aimtargvelocity));dprint(" * ");dprint(ftos(this.bot_aimlatency + vlen(this.bot_aimtargorigin - shotorg) / shotspeed));dprint(" = ");dprint(vtos(v));dprint(" : aimdir = ");dprint(vtos(normalize(v - shotorg)));dprint(" : ");dprint(vtos(shotdir));dprint("\n");
//traceline(shotorg, shotorg + shotdir * 10000, false, this);
//if (trace_ent.takedamage)