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

Difference between revisions of "ChangeYaw"

From Quake Wiki

m (Usage)
m (Usage)
 
Line 2: Line 2:
  
 
== Usage ==
 
== Usage ==
Turns an entity towards its '''ideal_yaw''' based off its '''turn_speed''', stopping once it reaches it. This will rotate the entity as quickly as the function is called. Mostly used with monsters to turn towards their enemies.
+
Turns an entity towards its '''ideal_yaw''' based off its '''yaw_speed''', stopping once it reaches it. This will rotate the entity as quickly as the function is called. Mostly used with monsters to turn towards their enemies.
  
 
'''Warning:''' The function assumes that '''self''' is the current entity trying to turn.
 
'''Warning:''' The function assumes that '''self''' is the current entity trying to turn.

Latest revision as of 13:45, 2 August 2023

void ChangeYaw()

Usage[edit]

Turns an entity towards its ideal_yaw based off its yaw_speed, stopping once it reaches it. This will rotate the entity as quickly as the function is called. Mostly used with monsters to turn towards their enemies.

Warning: The function assumes that self is the current entity trying to turn.

Example[edit]

// This monster calculates the direction towards its enemy then starts turning
self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
ChangeYaw();