Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

vectoyaw

From Quake Wiki

float vectoyaw(vector vec)

Usage[edit]

Gets the arc tangent of the vector's x and y values. This is equivalent to atan2 in other programming languages.

Parameters[edit]

  • vec
Stores the x and y arguments to pass to atan2. The z value does nothing.

Return[edit]

The angle of the x and y components of the vector. Can be a value in the range [0, 360).

Example[edit]

// Checks to see if the monster's enemy is in front of them before attacking
float yawTo = vectoyaw(self.enemy.origin - self.origin);

float delta = anglemod(self.angles.y - yawTo);
if (delta > 45 && delta < 315)
    return;