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

Editing walkmove

From Quake Wiki

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
''float'' '''walkmove'''(''float'' yaw, ''float'' dist)
+
====Syntax:====
 +
<code>float walkmove(float yaw, float dist)</code>
  
== Usage ==
+
Moves the entity referenced by self in the direction and distance specified.
Tries to move the entity in the given direction by the passed distance. This does not sweep the the entire movement area so large steps should be broken down into smaller parts, otherwise missed collisions can occur. This function only allows for manual movement on the x and y axes. By passing 0 for the distance it can be used to check the current position of the entity, allowing for manual collision detection.
+
====Parameters:====
 
+
:<code>yaw</code> - The direction that the entity will move in.
If the entity is not on the ground and cannot fly or swim, this will always fail. Note that for flying and swimming enemies, calling this will try and level them with their enemy.
+
:<code>dist</code> - The distance that the entity will move in.
 
+
====Returns:====
'''Warning:''' The function assumes that '''self''' is the current entity that's trying to move.
+
:Returns TRUE if the movement completed successfully, and FALSE if it did not.  The entity's position is reverted if the move is unsuccessful.
 
+
====Other Details:====
=== Parameters ===
+
walkmove, unlike movetogoal, does not affect the entity's angles so, in the case of monsters, it causes them to slide around.
*''yaw''
+
Also unlike movetogoal, walkmove does not affect vertical position at all and will not match heights with enemies.
:The direction the entity wants to move. This is not relative to its current angle.
 
*''dist''
 
:The distance to try and move in map units.
 
 
 
=== Return ===
 
Returns <code>TRUE</code> if the movement was successful.
 
 
 
== Example ==
 
// This function will attempt to move towards a monster's enemy with a slight angle
 
void SideSwipeAttack()
 
{
 
    if (!enemy_vis || enemy_range > RANGE_NEAR)
 
        return;
 
 
    walkmove(enemy_yaw + 15, 20);
 
    DoMeleeAttack();
 
}
 
  
 
[[Category:QuakeC Function]]
 
[[Category:QuakeC Function]]

Please note that all contributions to Quake Wiki are considered to be released under the GNU Free Documentation License 1.3 or later (see Quake Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)