3 // angles of the player's model (as opposed to his view which uses `.vector v_angle;`) in degrees
4 // x is pitch: positive means up (unlike .v_angle), usually is 0
5 // y is yaw: between -180 and 180, increases when turning left
6 // z is roll: positive means tilted clockwise, usually is 0
10 * Return a angle within +/- 360.
12 float anglemods(float v)
14 v = v - 360 * floor(v / 360);
25 * Return the short angle
27 float shortangle_f(float ang1, float ang2)
43 vector shortangle_v(vector ang1, vector ang2)
47 vtmp_x = shortangle_f(ang1_x,ang2_x);
48 vtmp_y = shortangle_f(ang1_y,ang2_y);
49 vtmp_z = shortangle_f(ang1_z,ang2_z);
54 vector shortangle_vxy(vector ang1, vector ang2)
56 vector vtmp = '0 0 0';
58 vtmp_x = shortangle_f(ang1_x,ang2_x);
59 vtmp_y = shortangle_f(ang1_y,ang2_y);
65 * Return the angle between two enteties
67 vector angleofs(entity from, entity to)
71 v_res = normalize(to.origin - from.origin);
72 v_res = vectoangles(v_res);
73 v_res = v_res - from.angles;
75 if (v_res_x < 0) v_res_x += 360;
76 if (v_res_x > 180) v_res_x -= 360;
78 if (v_res_y < 0) v_res_y += 360;
79 if (v_res_y > 180) v_res_y -= 360;
84 vector angleofs3(vector from, vector from_a, entity to)
88 v_res = normalize(to.origin - from);
89 v_res = vectoangles(v_res);
90 v_res = v_res - from_a;
92 if (v_res_x < 0) v_res_x += 360;
93 if (v_res_x > 180) v_res_x -= 360;
95 if (v_res_y < 0) v_res_y += 360;
96 if (v_res_y > 180) v_res_y -= 360;