Class Vector3
Version added:
before 9.5
The Vector3 class is used to represent a 3D vector or point.
If necessary, instances of this class can be created by:
- Local variable:
- Global (see Script Structure about conventions for naming globals):
If necessary, instances of this class can be created by:
- Local variable:
local vec3 = LM.Vector3:new_local()
- Global (see Script Structure about conventions for naming globals):
XX_vec3 = LM.Vector3:new()
Methods of Vector3:
Name | Returns | Description | Ver |
Cross | Vector3 | Computes the cross product of this vector and a second one | < 9.5 |
Dot | real | Computes the dot product of this vector and a second one | < 9.5 |
GetOrthogonals | void | Returns two vectors that are orthogonal to the original vector | < 9.5 |
Mag | real | Computes the magnitude of a vector | < 9.5 |
Norm | Vector3 | Returns a normalized copy of the vector | < 9.5 |
NormMe | void | Normalizes a vector | < 9.5 |
operator* | Vector3 | Multiplies a vector by a number, returning the result as a new vector | < 9.5 |
operator/ | Vector3 | Divides a vector by a number, returning the result as a new vector | < 9.5 |
operator‑ | Vector3 | Subtracts one vector from another and returns the result as a new vector | < 9.5 |
operator+ | Vector3 | Adds two vectors and returns the result as a new vector | < 9.5 |
Rotate | void | Rotates the vector around the specified axis by the specified angle | < 9.5 |
Set | void | Set the value of a vector | < 9.5 |
Set | void | Set the value of a vector | < 9.5 |
SquaredMag | real | Computes the squared magnitude of a vector | < 9.5 |
Properties of Vector3:
Name | Type | Description | Ver |
x | real | The x (or horizontal) coordinate of the vector. | < 9.5 |
y | real | The y (or vertical) coordinate of the vector. | < 9.5 |
z | real | The z (or depth) coordinate of the vector. | < 9.5 |