Vector2
A two-component value for 2D coordinates and calculations.
A Vector2 may mean a point, displacement, velocity or direction. Subtract positions in the same space for aiming; normalize only when unit length is required. Normalized of zero returns Zero but does not define a direction.
Ordinary 2D has X right and Y down, so Right.AngleTo(Down) = π/2 appears clockwise. Use Bounce with a unit surface normal for bouncing; this SDK Reflect gives the opposite result. This value neither moves a physics body nor queries collisions.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
Properties8
DownProperty
public static Vector2 Down { get; }Down unit vector. Y is down in 2D, so this vector points +Y.
InfProperty
public static Vector2 Inf { get; }Infinity vector, a vector with all components set to @C#.INF.
ItemProperty
public float this[int index] { get; set; }Access vector components using their index.
LeftProperty
public static Vector2 Left { get; }Left unit vector. Represents the direction of left.
OneProperty
public static Vector2 One { get; }One vector, a vector with all components set to 1.
RightProperty
public static Vector2 Right { get; }Right unit vector. Represents the direction of right.
UpProperty
public static Vector2 Up { get; }Up unit vector. Y is down in 2D, so this vector points -Y.
ZeroProperty
public static Vector2 Zero { get; }Zero vector, a vector with all components set to 0.
Methods72
AbsVector2
Anglefloat
public float Angle();Returns Mathf.Atan2(Y, X): the angle in radians relative to the positive X axis. Right has angle 0, and Down (positive Y in the usual 2D screen coordinates) has angle PI / 2.
floatThe angle of this vector, in radians.
AngleTofloat
public float AngleTo(Vector2 to);Returns a signed radian angle using atan2(Cross, Dot). Right → Down gives π/2, clockwise on a Y-down screen.
| Name | Type | Default |
|---|---|---|
to | Vector2 | — |
toOther nonzero direction in the same space; normalization is optional.
floatSigned angle atan2(Cross(to), Dot(to)) in radians. A zero vector has no geometric direction.
AngleToPointfloat
public float AngleToPoint(Vector2 to);Returns Mathf.Atan2(to.Y - Y, to.X - X), the angle in radians of the direction from this point to to. Both points must use the same coordinate system. This does not rotate an Entity or measure an angle between two independent direction vectors.
| Name | Type | Default |
|---|---|---|
to | Vector2 | — |
toThe other vector to compare this vector to.
floatThe angle between the two vectors, in radians.
Aspectfloat
BezierDerivativeVector2
public Vector2 BezierDerivative(Vector2 control1, Vector2 control2, Vector2 end, float t);Returns the derivative at the given t on the Bézier curve defined by this vector and the given control_1, control_2, and end points.
| Name | Type | Default |
|---|---|---|
control1 | Vector2 | — |
control2 | Vector2 | — |
end | Vector2 | — |
t | float | — |
control1Control point that defines the bezier curve.
control2Control point that defines the bezier curve.
endThe destination value for the interpolation.
tA value on the range of 0.0 to 1.0, representing the amount of interpolation.
Vector2The resulting value of the interpolation.
BezierInterpolateVector2
public Vector2 BezierInterpolate(Vector2 control1, Vector2 control2, Vector2 end, float t);Returns the point at the given t on the Bézier curve defined by this vector and the given control_1, control_2, and end points.
| Name | Type | Default |
|---|---|---|
control1 | Vector2 | — |
control2 | Vector2 | — |
end | Vector2 | — |
t | float | — |
control1Control point that defines the bezier curve.
control2Control point that defines the bezier curve.
endThe destination vector.
tA value on the range of 0.0 to 1.0, representing the amount of interpolation.
Vector2The interpolated vector.
BounceVector2
public Vector2 Bounce(Vector2 normal);Bounces velocity off a surface with a unit normal. (1,1) and Up produce (1,−1), opposite to this SDK Reflect result.
| Name | Type | Default |
|---|---|---|
normal | Vector2 | — |
normalThe normal vector defining the plane to bounce off. Must be normalized.
Vector2The bounced vector.
CeilVector2
public Vector2 Ceil();Returns a new vector with all components rounded up (towards positive infinity).
Clamp2 overloads
public Vector2 Clamp(Vector2 min, Vector2 max);Returns a new vector with all components clamped between the components of Vector2.Min and Vector2.Max, by running @GlobalScope.clamp on each component.
| Name | Type | Default |
|---|---|---|
min | Vector2 | — |
max | Vector2 | — |
minThe vector with minimum allowed values.
maxThe vector with maximum allowed values.
Vector2The vector with all components clamped.
public Vector2 Clamp(float min, float max);Returns a new vector with all components clamped between the components of Vector2.Min and Vector2.Max, by running @GlobalScope.clamp on each component.
| Name | Type | Default |
|---|---|---|
min | float | — |
max | float | — |
minThe minimum allowed value.
maxThe maximum allowed value.
Vector2The vector with all components clamped.
Crossfloat
public float Cross(Vector2 with);Returns scalar x₁y₂ − y₁x₂, not Vector3. Right.Cross(Down) = 1. Interpret its sign with the screen Y convention.
| Name | Type | Default |
|---|---|---|
with | Vector2 | — |
withThe other vector.
floatThe cross product value.
CubicInterpolateVector2
public Vector2 CubicInterpolate(Vector2 b, Vector2 preA, Vector2 postB, float weight);Performs a cubic interpolation between this vector and b using pre_a and post_b as handles, and returns the result at position weight. weight is on the range of 0.0 to 1.0, representing the amount of interpolation.
| Name | Type | Default |
|---|---|---|
b | Vector2 | — |
preA | Vector2 | — |
postB | Vector2 | — |
weight | float | — |
bThe destination vector.
preAA vector before this vector.
postBA vector after b.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
Vector2The interpolated vector.
CubicInterpolateInTimeVector2
public Vector2 CubicInterpolateInTime(Vector2 b, Vector2 preA, Vector2 postB, float weight, float t, float preAT, float postBT);Performs a cubic interpolation between this vector and b using pre_a and post_b as handles, and returns the result at position weight. weight is on the range of 0.0 to 1.0, representing the amount of interpolation.
It can perform smoother interpolation than Vector2.CubicInterpolate by the time values.
| Name | Type | Default |
|---|---|---|
b | Vector2 | — |
preA | Vector2 | — |
postB | Vector2 | — |
weight | float | — |
t | float | — |
preAT | float | — |
postBT | float | — |
bThe destination vector.
preAA vector before this vector.
postBA vector after b.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
Vector2The interpolated vector.
Deconstructvoid
public void Deconstruct(out float x, out float y);Helper method for deconstruction into a tuple.
| Name | Type | Default |
|---|---|---|
x | float | — |
y | float | — |
DirectionToVector2
public Vector2 DirectionTo(Vector2 to);Returns the normalized vector pointing from this vector to to.
a.direction_to(b) is equivalent to (b - a).normalized(). See also Vector2.Normalized.
| Name | Type | Default |
|---|---|---|
to | Vector2 | — |
toThe other vector to point towards.
Vector2The direction from this vector to to.
DistanceSquaredTofloat
public float DistanceSquaredTo(Vector2 to);Returns the squared Euclidean distance between this vector and to.
This method runs faster than Vector2.DistanceTo, so prefer it if you need to compare vectors or need the squared distance for some formula.
| Name | Type | Default |
|---|---|---|
to | Vector2 | — |
toThe other vector to use.
floatThe squared distance between the two vectors.
DistanceTofloat
public float DistanceTo(Vector2 to);Returns the Euclidean distance between this vector and to.
| Name | Type | Default |
|---|---|---|
to | Vector2 | — |
toThe other vector to use.
floatThe distance between the two vectors.
Dotfloat
public float Dot(Vector2 with);Dot product. For unit directions it is the angle cosine; otherwise it also includes both magnitudes.
| Name | Type | Default |
|---|---|---|
with | Vector2 | — |
withThe other vector to use.
floatThe dot product of the two vectors.
Equals2 overloads
public bool Equals(Vector2 other);Returns true if the vectors are exactly equal.
Note: Due to floating-point precision errors, consider using
Vector2.IsEqualApprox instead, which is more reliable.
| Name | Type | Default |
|---|---|---|
other | Vector2 | — |
otherThe other vector.
boolWhether or not the vectors are exactly equal.
public override bool Equals(object? obj);Returns true if the vector is exactly equal
to the given object (obj).
Note: Due to floating-point precision errors, consider using
Vector2.IsEqualApprox instead, which is more reliable.
| Name | Type | Default |
|---|---|---|
obj | object | — |
objThe object to compare with.
boolWhether or not the vector and the object are equal.
FloorVector2
public Vector2 Floor();Returns a new vector with all components rounded down (towards negative infinity).
FromAngleVector2
public static Vector2 FromAngle(float angle);Creates a Vector2 rotated to the given Vector2.Angle in radians. This is equivalent to doing Vector2(cos(angle), sin(angle)) or Vector2.RIGHT.rotated(angle).
print(Vector2.from_angle(0)) # Prints (1.0, 0.0)
print(Vector2(1, 0).angle()) # Prints 0.0, which is the angle used above.
print(Vector2.from_angle(PI / 2)) # Prints (0.0, 1.0)Note: The length of the returned Vector2 is approximately 1.0, but is is not guaranteed to be exactly 1.0 due to floating-point precision issues. Call Vector2.Normalized on the returned Vector2 if you require a unit vector.
| Name | Type | Default |
|---|---|---|
angle | float | — |
angleAngle of the vector, in radians.
Vector2The resulting vector.
GetHashCodeint
public override int GetHashCode();Serves as the hash function for Vector2.
intA hash code for this vector.
InverseVector2
public Vector2 Inverse();Returns the inverse of the vector. This is the same as Vector2(1.0 / v.x, 1.0 / v.y).
Vector2The inverse of this vector.
IsEqualApproxbool
public bool IsEqualApprox(Vector2 other);Returns true if this vector and to are approximately equal, by running @GlobalScope.is_equal_approx on each component.
| Name | Type | Default |
|---|---|---|
other | Vector2 | — |
otherThe other vector to compare.
boolWhether or not the vectors are approximately equal.
IsFinitebool
public bool IsFinite();Returns true if this vector is finite, by calling @GlobalScope.is_finite on each component.
boolWhether this vector is finite or not.
IsNormalizedbool
public bool IsNormalized();Returns true if the vector is normalized, i.e. its length is approximately equal to 1.
boolA bool indicating whether or not the vector is normalized.
IsZeroApproxbool
public bool IsZeroApprox();Returns true if this vector's values are approximately zero, by running @GlobalScope.is_zero_approx on each component.
This method is faster than using Vector2.IsEqualApprox with one value as a zero vector.
boolWhether or not the vector is approximately zero.
Lengthfloat
public float Length();Returns the length (magnitude) of this vector.
floatThe length of this vector.
LengthSquaredfloat
public float LengthSquared();Returns the squared length (squared magnitude) of this vector.
This method runs faster than Vector2.Length, so prefer it if you need to compare vectors or need the squared distance for some formula.
floatThe squared length of this vector.
LerpVector2
public Vector2 Lerp(Vector2 to, float weight);Interpolates linearly by weight. 0/1 give endpoints; out-of-range values can extrapolate. Weight is neither distance nor time.
| Name | Type | Default |
|---|---|---|
to | Vector2 | — |
weight | float | — |
toThe destination vector for interpolation.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
Vector2The resulting vector of the interpolation.
LimitLengthVector2
public Vector2 LimitLength(float length = 1f);Returns the vector with a maximum length by limiting its length to Vector2.Length. If the vector is non-finite, the result is undefined.
| Name | Type | Default |
|---|---|---|
length | float | 1f |
lengthThe length to limit to.
Vector2The vector with its length limited.
Max2 overloads
public Vector2 Max(Vector2 with);Returns the component-wise maximum of this and with, equivalent to Vector2(maxf(x, with.x), maxf(y, with.y)).
| Name | Type | Default |
|---|---|---|
with | Vector2 | — |
withThe other vector to use.
Vector2The resulting maximum vector.
public Vector2 Max(float with);Returns the component-wise maximum of this and with, equivalent to Vector2(maxf(x, with.x), maxf(y, with.y)).
| Name | Type | Default |
|---|---|---|
with | float | — |
withThe other value to use.
Vector2The resulting maximum vector.
MaxAxisIndexVector2.Axis
public Vector2.Axis MaxAxisIndex();Returns the axis of the vector's highest value. See AXIS_* constants. If all components are equal, this method returns Vector2.Axis.X.
Vector2.AxisThe index of the highest axis.
Min2 overloads
public Vector2 Min(Vector2 with);Returns the component-wise minimum of this and with, equivalent to Vector2(minf(x, with.x), minf(y, with.y)).
| Name | Type | Default |
|---|---|---|
with | Vector2 | — |
withThe other vector to use.
Vector2The resulting minimum vector.
public Vector2 Min(float with);Returns the component-wise minimum of this and with, equivalent to Vector2(minf(x, with.x), minf(y, with.y)).
| Name | Type | Default |
|---|---|---|
with | float | — |
withThe other value to use.
Vector2The resulting minimum vector.
MinAxisIndexVector2.Axis
public Vector2.Axis MinAxisIndex();Returns the axis of the vector's lowest value. See AXIS_* constants. If all components are equal, this method returns Vector2.Axis.Y.
Vector2.AxisThe index of the lowest axis.
MoveTowardVector2
public Vector2 MoveToward(Vector2 to, float delta);For finite delta ≥ 0, approaches without overshoot; a distance below Mathf.Epsilon snaps to the target. Negative delta normally moves away. For speed per second, pass speed × timestep.
| Name | Type | Default |
|---|---|---|
to | Vector2 | — |
delta | float | — |
toTarget value in the same coordinate space.
deltaFinite nonnegative step distance in vector units, for example speed × deltaTime. This is not a number of seconds.
Vector2New value; reaching the target or a distance below Mathf.Epsilon returns exactly to. The original vector is unchanged.
NormalizedVector2
public Vector2 Normalized();Returns unit direction, or Zero for a zero vector. Removes displacement magnitude; Zero does not define an aiming angle.
Vector2A unit-length copy for a nonzero vector, or Zero. The original value is unchanged.
OrthogonalVector2
public Vector2 Orthogonal();Returns a perpendicular vector rotated 90 degrees counter-clockwise compared to the original, with the same length.
Vector2The perpendicular vector.
PosMod2 overloads
public Vector2 PosMod(Vector2 modv);Returns a vector composed of the @GlobalScope.fposmod of this vector's components and mod.
| Name | Type | Default |
|---|---|---|
modv | Vector2 | — |
modvA vector representing the divisors of the operation.
public Vector2 PosMod(float mod);Returns a vector composed of the @GlobalScope.fposmod of this vector's components and mod.
| Name | Type | Default |
|---|---|---|
mod | float | — |
modA value representing the divisor of the operation.
ProjectVector2
public Vector2 Project(Vector2 onNormal);Returns a new vector resulting from projecting this vector onto the given vector b. The resulting new vector is parallel to b. See also Vector2.Slide.
Note: If the vector b is a zero vector, the components of the resulting new vector will be @C#.NAN.
| Name | Type | Default |
|---|---|---|
onNormal | Vector2 | — |
onNormalThe vector to project onto.
Vector2The projected vector.
ReflectVector2
public Vector2 Reflect(Vector2 normal);Computes 2 × dot(v,n) × n − v for unit n. This is negative Bounce; use Bounce for ordinary surface bouncing.
| Name | Type | Default |
|---|---|---|
normal | Vector2 | — |
normalThe normal vector defining the plane to reflect from. Must be normalized.
Vector2The reflected vector.
RotatedVector2
public Vector2 Rotated(float angle);Returns the result of rotating this vector by Vector2.Angle (in radians). See also @GlobalScope.deg_to_rad.
| Name | Type | Default |
|---|---|---|
angle | float | — |
angleThe angle to rotate by, in radians.
Vector2The rotated vector.
RoundVector2
public Vector2 Round();Returns a new vector with all components rounded to the nearest integer, with halfway cases rounded away from zero.
Vector2The rounded vector.
SignVector2
public Vector2 Sign();Returns a new vector with each component set to 1.0 if it's positive, -1.0 if it's negative, and 0.0 if it's zero. The result is identical to calling @GlobalScope.sign on each component.
Vector2A vector with all components as either 1, -1, or 0.
SlerpVector2
public Vector2 Slerp(Vector2 to, float weight);Returns the result of spherical linear interpolation between this vector and to, by amount weight. weight is on the range of 0.0 to 1.0, representing the amount of interpolation.
This method also handles interpolating the lengths if the input vectors have different lengths. For the special case of one or both input vectors having zero length, this method behaves like Vector2.Lerp.
| Name | Type | Default |
|---|---|---|
to | Vector2 | — |
weight | float | — |
toThe destination vector for interpolation.
weightA value on the range of 0.0 to 1.0, representing the amount of interpolation.
Vector2The resulting vector of the interpolation.
SlideVector2
public Vector2 Slide(Vector2 normal);Returns a new vector resulting from sliding this vector along a line with normal n. The resulting new vector is perpendicular to n, and is equivalent to this vector minus its projection on n. See also Vector2.Project.
Note: The vector n must be normalized. See also Vector2.Normalized.
| Name | Type | Default |
|---|---|---|
normal | Vector2 | — |
normalThe normal vector of the plane to slide on.
Vector2The slid vector.
Snapped2 overloads
public Vector2 Snapped(Vector2 step);Returns a new vector with each component snapped to the nearest multiple of the corresponding component in step. This can also be used to round the components to an arbitrary number of decimals.
| Name | Type | Default |
|---|---|---|
step | Vector2 | — |
stepA vector value representing the step size to snap to.
Vector2The snapped vector.
public Vector2 Snapped(float step);Returns a new vector with each component snapped to the nearest multiple of the corresponding component in step. This can also be used to round the components to an arbitrary number of decimals.
| Name | Type | Default |
|---|---|---|
step | float | — |
stepThe step size to snap to.
Vector2The snapped vector.
ToString2 overloads
public override string ToString();Converts this Vector2 to a string.
stringA string representation of this vector.
public string ToString(string? format);Converts this Vector2 to a string with the given format.
| Name | Type | Default |
|---|---|---|
format | string | — |
stringA string representation of this vector.
op_AdditionVector2
public static Vector2 operator +(Vector2 left, Vector2 right);Adds each component of the Vector2
with the components of the given Vector2.
| Name | Type | Default |
|---|---|---|
left | Vector2 | — |
right | Vector2 | — |
leftThe left vector.
rightThe right vector.
Vector2The added vector.
op_Division2 overloads
public static Vector2 operator /(Vector2 vec, Vector2 divisorv);Divides each component of the Vector2
by the components of the given Vector2.
| Name | Type | Default |
|---|---|---|
vec | Vector2 | — |
divisorv | Vector2 | — |
vecThe dividend vector.
divisorvThe divisor vector.
Vector2The divided vector.
public static Vector2 operator /(Vector2 vec, float divisor);Divides each component of the Vector2
by the given System.Single.
| Name | Type | Default |
|---|---|---|
vec | Vector2 | — |
divisor | float | — |
vecThe dividend vector.
divisorThe divisor value.
Vector2The divided vector.
op_Equalitybool
public static bool operator ==(Vector2 left, Vector2 right);Returns true if the vectors are exactly equal.
Note: Due to floating-point precision errors, consider using
Vector2.IsEqualApprox instead, which is more reliable.
| Name | Type | Default |
|---|---|---|
left | Vector2 | — |
right | Vector2 | — |
leftThe left vector.
rightThe right vector.
boolWhether or not the vectors are exactly equal.
op_GreaterThanbool
public static bool operator >(Vector2 left, Vector2 right);Compares two Vector2 vectors by first checking if
the X value of the left vector is greater than
the X value of the right vector.
If the X values are exactly equal, then it repeats this check
with the Y values of the two vectors.
This operator is useful for sorting vectors.
| Name | Type | Default |
|---|---|---|
left | Vector2 | — |
right | Vector2 | — |
leftThe left vector.
rightThe right vector.
boolWhether or not the left is greater than the right.
op_GreaterThanOrEqualbool
public static bool operator >=(Vector2 left, Vector2 right);Compares two Vector2 vectors by first checking if
the X value of the left vector is greater than
or equal to the X value of the right vector.
If the X values are exactly equal, then it repeats this check
with the Y values of the two vectors.
This operator is useful for sorting vectors.
| Name | Type | Default |
|---|---|---|
left | Vector2 | — |
right | Vector2 | — |
leftThe left vector.
rightThe right vector.
boolWhether or not the left is greater than or equal to the right.
op_Inequalitybool
public static bool operator !=(Vector2 left, Vector2 right);Returns true if the vectors are not equal.
Note: Due to floating-point precision errors, consider using
Vector2.IsEqualApprox instead, which is more reliable.
| Name | Type | Default |
|---|---|---|
left | Vector2 | — |
right | Vector2 | — |
leftThe left vector.
rightThe right vector.
boolWhether or not the vectors are not equal.
op_LessThanbool
public static bool operator <(Vector2 left, Vector2 right);Compares two Vector2 vectors by first checking if
the X value of the left vector is less than
the X value of the right vector.
If the X values are exactly equal, then it repeats this check
with the Y values of the two vectors.
This operator is useful for sorting vectors.
| Name | Type | Default |
|---|---|---|
left | Vector2 | — |
right | Vector2 | — |
leftThe left vector.
rightThe right vector.
boolWhether or not the left is less than the right.
op_LessThanOrEqualbool
public static bool operator <=(Vector2 left, Vector2 right);Compares two Vector2 vectors by first checking if
the X value of the left vector is less than
or equal to the X value of the right vector.
If the X values are exactly equal, then it repeats this check
with the Y values of the two vectors.
This operator is useful for sorting vectors.
| Name | Type | Default |
|---|---|---|
left | Vector2 | — |
right | Vector2 | — |
leftThe left vector.
rightThe right vector.
boolWhether or not the left is less than or equal to the right.
op_Modulus2 overloads
public static Vector2 operator %(Vector2 vec, Vector2 divisorv);Gets the remainder of each component of the Vector2
with the components of the given Vector2.
This operation uses truncated division, which is often not desired
as it does not work well with negative numbers.
Consider using Vector2.PosMod instead
if you want to handle negative numbers.
| Name | Type | Default |
|---|---|---|
vec | Vector2 | — |
divisorv | Vector2 | — |
vecThe dividend vector.
divisorvThe divisor vector.
Vector2The remainder vector.
public static Vector2 operator %(Vector2 vec, float divisor);Gets the remainder of each component of the Vector2
with the components of the given System.Single.
This operation uses truncated division, which is often not desired
as it does not work well with negative numbers.
Consider using Vector2.PosMod instead
if you want to handle negative numbers.
| Name | Type | Default |
|---|---|---|
vec | Vector2 | — |
divisor | float | — |
vecThe dividend vector.
divisorThe divisor value.
Vector2The remainder vector.
op_Multiply3 overloads
public static Vector2 operator *(Vector2 left, Vector2 right);Multiplies each component of the Vector2
by the components of the given Vector2.
| Name | Type | Default |
|---|---|---|
left | Vector2 | — |
right | Vector2 | — |
leftThe left vector.
rightThe right vector.
Vector2The multiplied vector.
public static Vector2 operator *(Vector2 vec, float scale);Multiplies each component of the Vector2
by the given System.Single.
| Name | Type | Default |
|---|---|---|
vec | Vector2 | — |
scale | float | — |
vecThe vector to multiply.
scaleThe scale to multiply by.
Vector2The multiplied vector.
public static Vector2 operator *(float scale, Vector2 vec);Multiplies each component of the Vector2
by the given System.Single.
| Name | Type | Default |
|---|---|---|
scale | float | — |
vec | Vector2 | — |
scaleThe scale to multiply by.
vecThe vector to multiply.
Vector2The multiplied vector.
op_SubtractionVector2
public static Vector2 operator -(Vector2 left, Vector2 right);Subtracts each component of the Vector2
by the components of the given Vector2.
| Name | Type | Default |
|---|---|---|
left | Vector2 | — |
right | Vector2 | — |
leftThe left vector.
rightThe right vector.
Vector2The subtracted vector.
op_UnaryNegationVector2
public static Vector2 operator -(Vector2 vec);Returns the negative value of the Vector2.
This is the same as writing new Vector2(-v.X, -v.Y).
This operation flips the direction of the vector while
keeping the same magnitude.
With floats, the number zero can be either positive or negative.
| Name | Type | Default |
|---|---|---|
vec | Vector2 | — |
vecThe vector to negate/flip.
Vector2The negated/flipped vector.
op_UnaryPlusVector2
public static Vector2 operator +(Vector2 vec);Returns the same value as if the + was not there.
Unary + does nothing, but sometimes it can make your
code more readable.
| Name | Type | Default |
|---|---|---|
vec | Vector2 | — |
vecThe vector to do nothing to.
Vector2The original vector.
Fields and constants2
XField
public float X;The vector's X component. Also accessible by using the index position [0].
YField
public float Y;The vector's Y component. Also accessible by using the index position [1].
Vector2.Axis
| Value | Description |
|---|---|
X = 0 | Enumerated value for the X axis. Returned by |
Y = 1 | Enumerated value for the Y axis. Returned by |