Primitive Class Vec3
Represents a float-based 3D vector.
Members
x | (float) X component. |
y | (float) Y component. |
z | (float) Z component. |
Functions
Vec3(x, y, z) | Create a Vec3 object. |
Vec3(value) | Create a Vec3 object. |
Vec3:Normalize() | Get a copy of this Vec3 normalized to length 1. |
Vec3:Rotate(rot) | Get a copy of this Vec3 rotated by the input Rotation object. |
Vec3:Lerp(vector, alpha) | Get the linearly interpolated Vec3 between this Vec3 and the input Vec3 according to the input interpolation alpha. |
Vec3:Cross(vector) | Get the cross product of this Vec3 and the input Vec3. |
Vec3:Dot(vector) | Get the dot product of this Vec3 and the input Vec3. |
Vec3:Distance(vector) | Get the distance between this Vec3 and the input Vec3. |
Vec3:Length() | Get the length of this Vec3. |
__tostring(This) | Metafunction. |
Members
Functions
- Vec3(x, y, z)
-
Create a Vec3 object. (x, y, z)
Parameters:
- x float X component.
- y float Y component.
- z float Z component.
Returns:
-
Vec3
A new Vec3 object.
- Vec3(value)
-
Create a Vec3 object. (value)
Parameters:
- value float X, Y, and Z component.
Returns:
-
Vec3
A new Vec3 object.
- Vec3:Normalize()
-
Get a copy of this Vec3 normalized to length 1. ()
Returns:
-
Vec3
Normalized vector.
- Vec3:Rotate(rot)
-
Get a copy of this Vec3 rotated by the input Rotation object. (rot)
Parameters:
- rot Rotation Rotation object.
Returns:
-
Vec3
Rotated Vec3.
- Vec3:Lerp(vector, alpha)
-
Get the linearly interpolated Vec3 between this Vec3 and the input Vec3 according to the input interpolation alpha. (vector)
Parameters:
- vector Vec3 Target interpolation vector.
- alpha float Interpolation alpha in the range [0, 1].
Returns:
-
Vec3
Linearly interpolated vector
- Vec3:Cross(vector)
-
Get the cross product of this Vec3 and the input Vec3. (vector)
Parameters:
- vector Vec3 Input vector.
Returns:
-
Vec3
Cross product.
- Vec3:Dot(vector)
-
Get the dot product of this Vec3 and the input Vec3. (vector)
Parameters:
- vector Vec3 Input vector.
Returns:
-
float
Dot product.
- Vec3:Distance(vector)
-
Get the distance between this Vec3 and the input Vec3. (vector)
Parameters:
- vector Vec3 Input vector.
Returns:
-
float
Distance.
- Vec3:Length()
-
Get the length of this Vec3. ()
Returns:
-
float
Length.
- __tostring(This)
-
Metafunction. Use tostring(vector).
Parameters:
- This Vec3 Vec3.
Returns:
-
string
A string showing the X, Y, and Z components of the Vec3.