Struct Vector2
Implements
Inherited Members
Namespace: GTA.Math
Assembly: ScriptHookVDotNet2.dll
Syntax
[Serializable]
public struct Vector2 : IEquatable<Vector2>
Constructors
| Name | Description |
|---|---|
| Vector2(Single, Single) | Initializes a new instance of the Vector2 class. |
Fields
| Name | Description |
|---|---|
| X | Gets or sets the X component of the vector. |
| Y | Gets or sets the Y component of the vector. |
Properties
| Name | Description |
|---|---|
| Down | Returns the down vector. (0,-1) |
| Item[Int32] | Gets or sets the component at the specified index. |
| Left | Returns the left vector. (-1,0) |
| Normalized | Returns this vector with a magnitude of 1. |
| Right | Returns the right vector. (1,0) |
| Up | Returns the up vector. (0,1) |
| Zero | Returns a null vector. (0,0) |
Methods
| Name | Description |
|---|---|
| Add(Vector2, Vector2) | Adds two vectors. |
| Angle(Vector2, Vector2) | Returns the angle in degrees between from and to. The angle returned is always the acute angle between the two vectors. |
| Clamp(Vector2, Vector2, Vector2) | Restricts a value to be within a specified range. |
| Distance(Vector2, Vector2) | Calculates the distance between two vectors. |
| DistanceSquared(Vector2, Vector2) | Calculates the squared distance between two vectors. |
| DistanceTo(Vector2) | Calculates the distance between two vectors. |
| DistanceToSquared(Vector2) | Calculates the squared distance between two vectors. |
| Divide(Vector2, Single) | Scales a vector by the given value. |
| Dot(Vector2, Vector2) | Calculates the dot product of two vectors. |
| Equals(Vector2) | Returns a value that indicates whether the current instance is equal to the specified object. |
| Equals(ref Vector2, ref Vector2) | Determines whether the specified object instances are considered equal. |
| Equals(Object) | Returns a value that indicates whether the current instance is equal to a specified object. |
| GetHashCode() | Returns the hash code for this instance. |
| Length() | Calculates the length of the vector. |
| LengthSquared() | Calculates the squared length of the vector. |
| Lerp(Vector2, Vector2, Single) | Performs a linear interpolation between two vectors. |
| Maximize(Vector2, Vector2) | Returns a vector containing the largest components of the specified vectors. |
| Minimize(Vector2, Vector2) | Returns a vector containing the smallest components of the specified vectors. |
| Modulate(Vector2, Vector2) | Modulates a vector by another. |
| Multiply(Vector2, Single) | Scales a vector by the given value. |
| Negate(Vector2) | Reverses the direction of a given vector. |
| Normalize() | Converts the vector into a unit vector. |
| Normalize(Vector2) | Converts the vector into a unit vector. |
| RandomXY() | Returns a new normalized vector with random X and Y components. |
| Reflect(Vector2, Vector2) | Returns the reflection of a vector off a surface that has the specified normal. |
| SignedAngle(Vector2, Vector2) | Returns the signed angle in degrees between from and to. |
| Subtract(Vector2, Vector2) | Subtracts two vectors. |
| ToHeading() | Converts a vector to a heading. |
| ToString() | Converts the value of the object to its equivalent string representation. |
| ToString(String) | Converts the value of the object to its equivalent string representation. |
Operators
| Name | Description |
|---|---|
| Addition(Vector2, Vector2) | Adds two vectors. |
| Division(Vector2, Single) | Scales a vector by the given value. |
| Equality(Vector2, Vector2) | Tests for equality between two objects. |
| Implicit(Vector2 to Vector3) | Converts a Vector2 to a Vector3 implicitly. |
| Inequality(Vector2, Vector2) | Tests for inequality between two objects. |
| Multiply(Vector2, Single) | Scales a vector by the given value. |
| Multiply(Single, Vector2) | Scales a vector by the given value. |
| Subtraction(Vector2, Vector2) | Subtracts two vectors. |
| UnaryNegation(Vector2) | Reverses the direction of a given vector. |