3 // angles of the player's model (as opposed to his view which uses `.vector v_angle;`)
4 // x is pitch, y is yaw, z is roll
8 * Return a angle within +/- 360.
10 float anglemods(float v)
12 v = v - 360 * floor(v / 360);
23 * Return the short angle
25 float shortangle_f(float ang1, float ang2)
41 vector shortangle_v(vector ang1, vector ang2)
45 vtmp_x = shortangle_f(ang1_x,ang2_x);
46 vtmp_y = shortangle_f(ang1_y,ang2_y);
47 vtmp_z = shortangle_f(ang1_z,ang2_z);
52 vector shortangle_vxy(vector ang1, vector ang2)
54 vector vtmp = '0 0 0';
56 vtmp_x = shortangle_f(ang1_x,ang2_x);
57 vtmp_y = shortangle_f(ang1_y,ang2_y);
63 * Return the angle between two enteties
65 vector angleofs(entity from, entity to)
69 v_res = normalize(to.origin - from.origin);
70 v_res = vectoangles(v_res);
71 v_res = v_res - from.angles;
73 if (v_res_x < 0) v_res_x += 360;
74 if (v_res_x > 180) v_res_x -= 360;
76 if (v_res_y < 0) v_res_y += 360;
77 if (v_res_y > 180) v_res_y -= 360;
82 vector angleofs3(vector from, vector from_a, entity to)
86 v_res = normalize(to.origin - from);
87 v_res = vectoangles(v_res);
88 v_res = v_res - from_a;
90 if (v_res_x < 0) v_res_x += 360;
91 if (v_res_x > 180) v_res_x -= 360;
93 if (v_res_y < 0) v_res_y += 360;
94 if (v_res_y > 180) v_res_y -= 360;