🌐Vector
Last updated
Last updated
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Create a new Vector.
string
Overload for operator +
Name | Type | Description |
---|---|---|
Overload for operator -
Overload for operator /
Overload for operator *
Vector
): boolean
Overload for operator ==
Vector
): number
Computes the distance from this vector to other.
Vector
): number
Computes the distance from this vector to other ignoring Z axis.
Vector
Returns this vector with a length of 1.
When normalized, a vector keeps the same direction but its length is 1.0.
Note that the current vector is unchanged and a new normalized vector is returned. If you want to normalize the current vector, use Vector:Normalize
function.
nil
Makes this vector have a length of 1.
When normalized, a vector keeps the same direction but its length is 1.0.
Note that this function will change the current vector. If you want to keep the current vector unchanged, use Vector:Normalized
function.
Vector
): number
Dot Product of two vectors. The dot product is a float value equal to the magnitudes of the two vectors multiplied together and then multiplied by the cosine of the angle between them. For normalized vectors Dot returns 1 if they point in exactly the same direction, -1 if they point in completely opposite directions and zero if the vectors are perpendicular. More
Vector
): number
Dot Product of two vectors ignoring Z axis.
number
): Vector
Returns this vector multiplied by the given number. The same as Vector * number
.
number
): nil
Multiplies this vector by the given number. The same as Vector = Vector * number
.
number
Returns the length of this vector.
The length of the vector is math.sqrt(x*x+y*y+z*z)
.
If you only need to compare length of some vectors, you can compare squared magnitudes of them using LengthSqr (computing squared length is faster).
number
Returns the squared length of this vector. This method is faster than Length because it avoids computing a square root. Use this method if you need to compare vectors.
number
Returns the length of this vector ignoring Z axis.
number
Returns the squared length of this vector ignoring Z axis. This method is faster than Length2D because it avoids computing a square root. Use this method if you need to compare vectors.
Returns the new vector rotated counterclockwise by the given angle in the XY-plane, leaving the Z-axis unaffected.
Rotates this vector counterclockwise by the given angle in the XY-plane, leaving the Z-axis unaffected.
Returns linearly interpolated vector between two vectors.
The value returned equals a + (b - a) * t (which can also be written a * (1-t) + b*t).
When t = 0
, a:Lerp(b, t) returns a
.
When t = 1
, a:Lerp(b, t) returns b
.
When t = 0.5
, a:Lerp(b, t) returns the point midway between a
and b
.
Returns cross product of two vectors. More Visualization
Moves vector forward by a specified distance in the direction defined by a given Angle.
Vector
Converts Vector to Angle. See https://github.com/ValveSoftware/source-sdk-2013/blob/master/sp/src/mathlib/mathlib_base.cpp#L535
Vec2
, boolean
Converts Vector to screen coordinate
number
, number
, number
Returns x, y and z of this vector.
number
Returns x of this vector. The same as Vector.x.
number
Returns y of this vector. The same as Vector.y.
number
Returns z of this vector. The same as Vector.z.
number
): nil
Sets x. The same as Vector.x = value.
number
): nil
Sets y. The same as Vector.y = value.
number
): nil
Sets z. The same as Vector.z = value.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|