Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!
Difference between revisions of "vectoyaw"
From Quake Wiki
m (→Example) |
|||
Line 12: | Line 12: | ||
== Example == | == Example == | ||
− | // Checks to see if the monster's enemy is in front of them before attacking | + | // Checks to see if the monster's enemy is in front of them before attacking |
float yawTo = vectoyaw(self.enemy.origin - self.origin); | float yawTo = vectoyaw(self.enemy.origin - self.origin); | ||
Latest revision as of 12:25, 31 July 2023
float vectoyaw(vector vec)
Contents
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;