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 Cross(vec2) | Vector3 | Computes the cross product of this vector and a second one | < 9.5 |
| Dot Dot(vec2) | real | Computes the dot product of this vector and a second one | < 9.5 |
| GetOrthogonals GetOrthogonals(vecU, vecV) | void | Returns two vectors that are orthogonal to the original vector | < 9.5 |
| Mag Mag() | real | Computes the magnitude of a vector | < 9.5 |
| Norm Norm() | Vector3 | Returns a normalized copy of the vector | < 9.5 |
| NormMe NormMe() | void | Normalizes a vector | < 9.5 |
| operator ‑ operator - (vec2) | Vector3 | Subtracts one vector from another and returns the result as a new vector | < 9.5 |
| operator * operator * (f) | Vector3 | Multiplies a vector by a number, returning the result as a new vector | < 9.5 |
| operator + operator + (vec2) | Vector3 | Adds two vectors and returns the result as a new vector | < 9.5 |
| operator / operator / (f) | Vector3 | Divides a vector by a number, returning the result as a new vector | < 9.5 |
| Rotate Rotate(axis, angle) | void | Rotates the vector around the specified axis by the specified angle | < 9.5 |
| Set Set(vx, vy, vz) | void | Assign new X, Y and Y coordinate values to the Vector3 | < 9.5 |
| Set Set(vec2) | void | Copy the coordinates from another Vector3 object | < 9.5 |
| SquaredMag 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 |