# Vector2||doc136779

September 20, 2022

# Vector2

2D vector, which is used in some places to represent 2D positions and vectors (such as texture coordinates in mesh or texture offsets in material).

## Constructor

 `Vector2` Vector2.new( `float` x, `float` y ) Create a 2D vector type data `Vector2` Vector2.new( `Vector2` vec ) Create a 2D vector type data

## Attribute

 `float` X 2D vector X axis `float` Y 2D vector Y axis `Vector2` Normalized [ReadOnly] Normalized vector of two-dimensional vector `float` Len [ReadOnly] Length of 2D vector

## Static properties

 `Vector2` Vector2.Zero [ReadOnly] Equivalent to vector2 new(0, 0) `Vector2` Vector2.One [ReadOnly] Equivalent to vector2 new(1, 1) `Vector2` Vector2.Right [ReadOnly] Equivalent to vector2 new(1, 0) `Vector2` Vector2.Up [ReadOnly] Equivalent to vector2 new(0, 1)

## Static function

 `float` Vector2.Dot( `Vector2` vec1, `Vector2` vec2 ) Calculating the dot product of two vectors `float` Vector2.AngleBetween( `Vector2` lookVec1, `Vector2` lookVec2 ) Calculate the angle between two vectors `float` Vector2.Distance( `Vector2` vec1, `Vector2` vec2 ) Calculate the distance between two vectors `Vector2` Vector2.Lerp( `Vector2` fromVec, `Vector2` toVec, `float` time ) Calculate the linear interpolation between two vectors `Vector2` Vector2.MoveTowards( `Vector2` fromVec, `Vector2` toVec, `float` moveDistance ) Calculate the vector after a vector moves the specified distance to the target vector, and it will not exceed the target vector

## operation

 `Vector2` Vector2 + Vector2 Overloaded + operator plus another vector `Vector2` Vector2 – Vector2 Overloading the – sign operator, subtracting another vector `Vector2` Vector2 * number Overloaded * operator multiplied by a numeric value `Vector2` Vector2 / number Overloaded / operator, divided by a numeric value `Vector2` -Vector2 Overloaded symbolic operators, negating `bool` Vector2 == Vector2 Overloaded symbol operation to judge whether two vectors are equal `bool` Vector2 < Vector2 Overloaded symbol operation, vector 1 < vector 2 `bool` Vector2 <= Vector2 Overloaded symbol operation, vector 1 < = vector 2 `bool` Vector2 > Vector2 Overloaded symbol operation, vector 1 > vector 2 `bool` Vector2 >= Vector2 Overloaded symbol operation, vector 1 > = vector 2