by Spike » Sat Jun 28, 2014 8:53 pm
'0 0 0' isn't a direction, its a location.
by fixed location, I mean x=1
v_angle is unused on non-player fields. its the angle received from the client, like .movement is the forward/right/up speeds the player wishes to move at.
v_forward, v_right, v_up are 3 vectors, combining to form a 3*3 orientation matrix which you can use to rotate stuff by the angles of the player.
here's some fun maths
makevectors(self.v_angle);
relative = other.origin - self.origin;
dirs_x = v_forward*relative;
dirs_y = v_right*relative;
dirs_z = v_up*relative;
'dirs' is now the 'relative' vector but rotated into a frame of reference relative to the player's angles. all distance stuff will have been preserved. It says how far forward, how far right, and how far up the target is according to the orientation given.
and then we can mess around with the player a bit
self.v_angle_y += 180;
makevectors(self.v_angle);
targ = v_forward * dirs_x + v_right * dirs_y + v_up * dirs_z;
and 'targ' is now pointing out and away from the player, but rotated by 180 degrees around the z axis (yay yaw). if dirs_z was 0, then its exactly opposite the original 'relative' direction (the matrix was rotated, not inverted, hence why only if z=0).
so, ceriux, when you seem to dismiss v_forward as being merely 'like velocity forward', you are oh so wrong. it is much more useful than merely that.
.