vec_for_angle(VECTOR* vec,ANGLE* ang)

Creates a unit vector (a vector of length 1) pointing into the direction given by the angle.

Parameters:

vec vector to be set by this function
ang Euler angle.

Returns:

vec

Modifies:

vec

Speed:

Fast

Algorithm:

VECTOR.x = cos(ANGLE.pan)*cos(ANGLE.tilt);
VECTOR.y = sin(ANGLE.pan)*cos(ANGLE.tilt);
VECTOR.z = sin(ANGLE.tilt);

Example:

vec_for_angle(vTemp,vector(90,0,0));
// sets vTemp to (0,1,0)

See also:

Vectors, vec_to_screen, rel_to_screen, rel_for_screen, vec_rotate

► latest version online