Class Vector2
Version added:
before 9.5
The Vector2 class is used to represent a 2D 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 vec2 = LM.Vector2:new_local()
- Global (see Script Structure about conventions for naming globals):
XX_vec2 = LM.Vector2:new()
Methods of Vector2:
Name | Returns | Description | Ver |
Cross | Vector3 | Added in version 11.1 | 11.1 |
Dot | real | Computes the dot product of this vector and a second one | < 9.5 |
GetOrthogonal | Vector2 | Returns a vector that points 90 degrees away from the orignal vector | < 9.5 |
Mag | real | Computes the magnitude of a vector | < 9.5 |
Norm | Vector2 | Returns a normalized copy of the vector | < 9.5 |
NormMe | void | Normalizes a vector | < 9.5 |
operator* | Vector2 | Multiplies a vector by a number, returning the result as a new vector | < 9.5 |
operator/ | Vector2 | Divides a vector by a number, returning the result as a new vector | < 9.5 |
operator‑ | Vector2 | Subtracts one vector from another and returns the result as a new vector | < 9.5 |
operator+ | Vector2 | Adds two vectors and returns the result as a new vector | < 9.5 |
Rotate | void | Rotates the vector 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 Vector2:
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 |