vec_to_angle (ANGLE* ang, VECTOR* dir);
Computes the pan and tilt
angles of a direction vector, and places them into
the pan and tilt parameters
of an Euler angle. Very useful for trading an angle for a direction, thus computing
the angles to a
target.
Parameters:
| ang |
Euler angle to be calculated. |
| dir |
direction vector. |
Returns:
ang
Modifies:
ang
Speed:
FastExample:
function turn_towards_target()
{
// get the direction from the entity MY to the entity YOU
vec_set(temp,your.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan,temp); // now MY looks at YOU
}
See also:
ang_add, vec_rotate