Class "Vector"⚓︎
Constructors⚓︎
Vector ()⚓︎
Vector Vector ( float , float )⚓︎
Constants⚓︎
Vector.Zero⚓︎
Vector.One⚓︎
Operators⚓︎
__add ()⚓︎
Vector __add ( Vector Right )⚓︎
Defines the Addition of two Vector objects using the +
operator.
Example Code
1 2 3 |
|
__div ()⚓︎
Vector __div ( float Modifier )⚓︎
Defines the Division of two Vector objects using the /
operator.
Example Code
1 2 3 |
|
__mul ()⚓︎
Vector __mul ( float Modifier )⚓︎
Defines the Multiplication of two Vector objects using the *
operator.
Example Code
1 2 3 |
|
__sub ()⚓︎
Vector __sub ( Vector Right )⚓︎
Defines the Subtraction of two Vector objects using the -
operator.
Example Code
1 2 3 |
|
__unm ()⚓︎
Vector __unm ( Vector Right )⚓︎
Defines the inversion of a Vector object using the -
operator.
Example Code
1 2 |
|
Functions⚓︎
Clamp ()⚓︎
void Clamp ( float MinX, float MinY, float MaxX, float MaxY )⚓︎
Clamps the vector based on left, top, right, bottom boundings. Doesn't keep direction
Clamped ()⚓︎
Vector Clamped ( float MinX, float MinY, float MaxX, float MaxY )⚓︎
Returns a clamped version of the vector.
Cross ()⚓︎
float Cross ( Vector second )⚓︎
Cross product this is the 2x2 matrix determinant or the resulting z value for their 3D versions with z=0
Distance ()⚓︎
float Distance ( Vector first, Vector second )⚓︎
Returns distance between two vectors
Example Code
1 |
|
Distance·Squared ()⚓︎
float DistanceSquared ( Vector first, Vector second )⚓︎
Returns squared distance between two vectors
Example Code
1 |
|
Dot ()⚓︎
float Dot ( Vector second )⚓︎
Dot product
From·Angle ()⚓︎
static Vector FromAngle ( float AngleDegrees )⚓︎
Build a Vector from an angle, returns a normalized vector. Angle 0 will result in (1, 0). Angle 90 will result in (0, 1).
Example Code
This code returns a vector that has a 45 degree angle
1 |
|
Get·Angle·Degrees ()⚓︎
float GetAngleDegrees ( )⚓︎
Returns the angle the vector is facing. The vector (1, 0) will be at 0 degrees. The vector (0, 1) will be at 90 degrees.
Practically, this means:
- Right: 0
- Up: -90
- Left: 180
- Down: 90
Example Code
This code returns the angle between two positions.
1 2 3 4 |
|
Length ()⚓︎
float Length ( )⚓︎
Returns the length of the vector
Length·Squared ()⚓︎
float LengthSquared ( )⚓︎
Returns the length squared of the vector
Lerp ()⚓︎
Vector Lerp ( Vector first, Vector second, float t )⚓︎
Linear interpolation between two vectors. For t = 0 it returns the first Vector, for t = 1 it returns the second.
Alternate Function example
This function does the same as Lerp, but will not alter the input vectors.
1 2 3 |
|
Example Code
This code will make v1 the vector 50% in between v1 and v2
1 2 3 |
|
Normalize ()⚓︎
void Normalize ( )⚓︎
Normalizes this vector, effectively making its length equal 1.
Normalized ()⚓︎
Vector Normalized ( )⚓︎
Returns a normalized version of this vector, effectively making its length equal 1.
Resize ()⚓︎
void Resize ( float NewLength )⚓︎
Resizes the vector length.
Resized ()⚓︎
Vector Resized ( float NewLength )⚓︎
Returns a resized version of the vector.
Rotated ()⚓︎
Vector Rotated ( float AngleDegrees )⚓︎
Returns a rotated version of the vector by AngleDegrees
__tostring ()⚓︎
void __tostring ( )⚓︎
Vector objects can be cast to a string object, which returns information about this object in the following format:
1 |
|
Variables⚓︎
X⚓︎
float X⚓︎
Components of vector.