Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!
Difference between revisions of "vlen"
From Quake Wiki
(Created page with "====Syntax:==== <code>float vlen(vector vec)</code> Gets the length of a vector ====Parameters:==== :<code>vec</code> - The vector to measure ====Returns:==== :Returns the le...") |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | + | ''float'' '''vlen'''(''vector'' vec) | |
− | |||
− | + | == Usage == | |
− | + | Gets the length of the vector. This is always a positive value. | |
− | |||
− | |||
− | |||
+ | === Parameters === | ||
+ | *''vec'' | ||
+ | :The vector to get the length of. | ||
+ | |||
+ | === Return === | ||
+ | The length of the passed vector. | ||
+ | |||
+ | == Example == | ||
+ | // Check to make sure a monster's enemy is in range for an attack | ||
+ | float distance = vlen(self.enemy.origin - self.origin); | ||
+ | if (distance > 512) | ||
+ | return; | ||
[[Category:QuakeC Function]] | [[Category:QuakeC Function]] |
Latest revision as of 12:17, 31 July 2023
float vlen(vector vec)
Contents
Usage[edit]
Gets the length of the vector. This is always a positive value.
Parameters[edit]
- vec
- The vector to get the length of.
Return[edit]
The length of the passed vector.
Example[edit]
// Check to make sure a monster's enemy is in range for an attack float distance = vlen(self.enemy.origin - self.origin); if (distance > 512) return;