Vector2
The Vector2 data type represents a 2D value with direction and magnitude. Some applications include GUI elements and 2D mouse positions.
Math Operations
The following math operations are valid for the Vector2 data type:
Operation | Description |
---|---|
Vector2 + Vector2 | Produces a Vector2 with each component of the second added to the corresponding component of the first. |
Vector2 - Vector2 | Produces a Vector2 with each component of the second subtracted from the corresponding component of the first. |
Vector2 * Vector2 | Produces a Vector2 with each component of the second multiplied by the corresponding component of the first. |
Vector2 / Vector2 | Produces a Vector2 with each component of the first divided by the corresponding component of the second. |
Vector2 * number | Produces a Vector2 with each component multiplied by the number. |
Vector2 / number | Produces a Vector2 with each component divided by the number. |
Summary
Properties
Methods
Returns the cross product of the two vectors.
Returns a new vector from the absolute values of the original's components.
Returns a new vector from the ceiling of the original's components.
Returns a new vector from the floor of the original's components.
Returns a new vector from the sign (-1, 0, or 1) of the original's components.
Returns the angle in radians between the two vectors.
Returns a scalar dot product of the two vectors.
Returns a Vector2 linearly interpolated between this Vector2 and the given goal by the given alpha.
Returns a Vector2 with each component as the highest among the respective components of the provided Vector2 objects.
Returns a Vector2 with each component as the lowest among the respective components of the provided Vector2 objects.