Vector used for 2D math.
``````    public struct Vector2 : IEquatable<Vector2>
``````

2-element structure that can be used to represent positions in 2d space or any other pair of numeric values.

### Static Properties

``````    public static  Down { get; }
``````

``````    public static  Left { get; }
``````

``````    public static  NegOne { get; }
``````

``````    public static  One { get; }
``````

``````    public static  Right { get; }
``````

``````    public static  Up { get; }
``````

``````    public static  Zero { get; }
``````

### Constructors

``````    public Vector2(float x, float y)
``````

Constructs a new Vector2 from the given x and y.

``````    public Vector2(Vector2 v)
``````

``````    public Vector2()
``````

### Fields

``````    public Single x
``````

The vector’s x component.

``````    public Single y
``````

The vector’s y component.

### Properties

``````    public float this[] { get; set; }
``````

### Methods

``````    public Vector2 Abs()
``````

Returns a new vector with all components in absolute values (i.e. positive).

``````    public float Angle()
``````

Returns the vector’s angle in radians with respect to the x-axis, or `(1, 0)` vector.

Equivalent to the result of atan2 when called with the vector’s x and y as parameters: `atan2(x, y)`.

``````    public float AngleTo(Vector2 to)
``````

Returns the angle in radians between the two vectors.

``````    public float AngleToPoint(Vector2 to)
``````

Returns the angle in radians between the line connecting the two points and the x coordinate.

``````    public float Aspect()
``````

Returns the ratio of x to y.

``````    public Vector2 Bounce(Vector2 n)
``````

Returns the vector “bounced off” from a plane defined by the given normal.

``````    public Vector2 Ceil()
``````

Returns the vector with all components rounded up.

``````    public Vector2 Clamped(float length)
``````

Returns the vector with a maximum length.

``````    public float Cross(Vector2 b)
``````

``````    public Vector2 CubicInterpolate(Vector2 b, Vector2 preA, Vector2 postB, float t)
``````

Cubicly interpolates between this vector and `b` using `preA` and `postB` as handles, and returns the result at position `t`. `t` is in the range of `0.0 - 1.0`, or a percentage of how far along the interpolation is.

``````    public float DistanceSquaredTo(Vector2 to)
``````

Returns the squared distance to vector `b`. Prefer this function over DistanceTo(Godot.Vector2) if you need to sort vectors or need the squared distance for some formula.

``````    public float DistanceTo(Vector2 to)
``````

Returns the distance to vector `b`.

``````    public float Dot(Vector2 with)
``````

Returns the dot product with vector `b`.

``````    public override bool Equals(object obj)
``````

``````    public bool Equals(Vector2 other)
``````

``````    public Vector2 Floor()
``````

Returns the vector with all components rounded down.

``````    public override int GetHashCode()
``````

``````    public bool IsNormalized()
``````

Returns `true` if the vector is normalized.

``````    public float Length()
``````

Returns the vector’s length.

``````    public float LengthSquared()
``````

Returns the vector’s length squared. Prefer this function over Length() if you need to sort vectors or need the squared length for some formula.

``````    public Vector2 LinearInterpolate(Vector2 b, float t)
``````

Returns the result of the linear interpolation between this vector and `b` by amount `t`. `t` is in the range of `0.0 - 1.0`, a percentage of how far along the interpolation is.

``````    public Vector2 Normalized()
``````

Returns the vector scaled to unit length. Equivalent to `v / v.length()`.

``````    public Vector2 Reflect(Vector2 n)
``````

Returns the vector reflected from a plane defined by the given normal.

``````    public Vector2 Rotated(float phi)
``````

Returns the vector rotated by `phi` radians.

``````    public Vector2 Round()
``````

``````    public void Set(float x, float y)
``````

``````    public void Set(Vector2 v)
``````

``````    public Vector2 Slerp(Vector2 b, float t)
``````

``````    public Vector2 Slide(Vector2 n)
``````

Returns the component of the vector along a plane defined by the given normal.

``````    public Vector2 Snapped(Vector2 by)
``````

Returns the vector snapped to a grid with the given size.

``````    public Vector2 Tangent()
``````

Returns a perpendicular vector.

``````    public override string ToString()
``````

``````    public string ToString(string format)
``````

### Operators

``````    public static Vector2 operator +(Vector2 left, Vector2 right)
``````

``````    public static Vector2 operator /(Vector2 vec, float scale)
``````

``````    public static Vector2 operator /(Vector2 left, Vector2 right)
``````

``````    public static bool operator ==(Vector2 left, Vector2 right)
``````

``````    public static bool operator >(Vector2 left, Vector2 right)
``````

``````    public static bool operator >=(Vector2 left, Vector2 right)
``````

``````    public static bool operator !=(Vector2 left, Vector2 right)
``````

``````    public static bool operator <(Vector2 left, Vector2 right)
``````

``````    public static bool operator <=(Vector2 left, Vector2 right)
``````

``````    public static Vector2 operator *(Vector2 vec, float scale)
``````

``````    public static Vector2 operator *(float scale, Vector2 vec)
``````

``````    public static Vector2 operator *(Vector2 left, Vector2 right)
``````

``````    public static Vector2 operator -(Vector2 left, Vector2 right)
``````

``````    public static Vector2 operator -(Vector2 vec)
``````
Tags: