⚙️Vector
This type is a common 3D vector (x, y, z).
This type supports operations, such as +, -, /, * and ==
x
Field
Type: float
X coordinate.
y
Field
Type: float
Y coordinate.
z
Field
Type: float
Z coordinate.
__call
Constructor
Constructs a vector.
Arguments
1. Default vector (0, 0, 0).
None.
2. Single value.
Name
Type
Description
value
float
X and Y coordinates.
3. XYZ values.
Name
Type
Description
x
float
X coordinate.
y
float
Y coordinate.
z
float
Z coordinate.
Returns
Type
Description
Vector
Vector.
Example
IsZero
Method
Returns true if this vector is within tolerance range.
Arguments
Name
Type
Description
tolerance
float
Max allowed tolerance. Defaults to 0.01.
Returns
Type
Description
bool
true if ranges between -tolerance and tolerance.
Example
Clone
Method
Returns a new copy of this vector.
Arguments
None.
Returns
Type
Description
Vector
The copied vector
Example
Dist
Method
Returns distance to another vector.
Arguments
Name
Type
Description
other
Vector
Vector to calculate distance against.
Returns
Type
Description
float
Distance to other vector.
Example
DistSqr
Method
Returns squared distance to another vector.
This method is de-facto faster than the non-squared variant. Use it, if you need extra performance.
Arguments
Name
Type
Description
other
Vector
Vector to calculate distance against.
Returns
Type
Description
float
Squared distance to other vector.
Example
Dist2d
Method
Returns 2D (only x and y values) distance to another vector.
Arguments
Name
Type
Description
other
Vector
Vector to calculate distance against.
Returns
Type
Description
float
Distance to other vector.
Example
Dist2dSqr
Method
Returns squared 2D (only x and y values) distance to another vector.
This method is de-facto faster than the non-squared variant. Use it, if you need extra performance.
Arguments
Name
Type
Description
other
Vector
Vector to calculate distance against.
Returns
Type
Description
float
Squared distance to other vector.
Example
Cross
Method
Returns a cross product to another vector.
Arguments
Name
Type
Description
other
Vector
Vector to calculate cross product against.
Returns
Type
Description
Vector
Cross product.
Example
IsValid
Method
Returns true if all values in this vector are finite.
Arguments
None.
Returns
Type
Description
bool
true if values are finite.
Example
Length
Method
Returns length of this vector.
Arguments
None.
Returns
Type
Description
float
Length of this vector.
Example
LengthSqr
Method
Returns squared length of this vector.
This method is de-facto faster than the non-squared variant. Use it, if you need extra performance.
Arguments
None.
Returns
Type
Description
float
Length of this vector.
Example
Length2d
Method
Returns 2D length of this vector.
Arguments
None.
Returns
Type
Description
float
Length of this vector.
Example
Length2dSqr
Method
Returns squared 2D length of this vector.
This method is de-facto faster than the non-squared variant. Use it, if you need extra performance.
Arguments
None.
Returns
Type
Description
float
Length of this vector.
Example
Dot
Method
Returns dot product of 2 vectors.
Arguments
Name
Type
Description
other
Vector
Vector to calculate dot product against.
Returns
Type
Description
float
Dot product.
Example
GetForward
Method
Returns the direction/forward vector of an angle.
Arguments
None.
Returns
Type
Description
Vector
The forward vector
Example
AngleVectors
Method
Returns the forward, right and up vectors of an angle.
Arguments
None.
Returns
Type
Description
Vector
The forward vector
Vector
The right vector
Vector
The up vector
Example
VectorAngles
Method
Returns the angle of a vector.
Arguments
None.
Returns
Type
Description
Vector
The angles
Example
Normalize
Method
Normalizes this vector, turning it into an unit/direction vector.
Arguments
None.
Returns
Nothing.
Example
Normalized
Method
Returns a normalized version of this vector, turning it into an unit/direction vector.
Arguments
None.
Returns
Type
Description
Vector
The normalized vector
Example
Last updated