Documentation

Support

Unity Studio

Open Unity Studio

Unity Studio

Vector2 node

Use the Vector2 node to access preset 2D vector variables and common methods.
Read time 1 minuteLast updated 19 days ago

The Vector2 node is a 2D vector toolbox for positions and directions (X, Y). Typical uses:
  • Measure distance/length on a 2D plane (for example, UI movement).
  • Normalize directions and blend or scale them.
  • Access common vectors like zero and one.

Variables

Expand the Vector2 node to access the following preset variables:

Variable

Type

Description

down
Vector2
A vector pointing in the downward direction (0, -1).
left
Vector2
A vector pointing in the left direction (-1, 0).
one
Vector2
A vector with all components set to 1 (1, 1).
right
Vector2
A vector pointing in the right direction (1, 0).
up
Vector2
A vector pointing in the upward direction (0, 1).
zero
Vector2
A vector with all components set to 0 (0, 0).

Methods

Expand the Vector2 node to access the following methods:

Method

Return type

Description

Angle
float
The angle in degrees between two vectors, measured from the first vector to the second vector. The result is always between 0 and 180 degrees.
Distance
float
The distance between two points in 2D space.
Dot
float
The dot product of two vectors, which is a measure of how much one vector goes in the direction of another. You can use it to determine the angle between two vectors or to project one vector onto another.
Lerp
Vector2
A linear interpolation between two vectors based on a given interpolation factor (t). When t is 0, the result is the first vector. When t is 1, the result is the second vector. When t is between 0 and 1, the result is a blend of the two vectors.
Max
Vector2
A vector that contains the maximum value of each component from two vectors.
Min
Vector2
A vector that contains the minimum value of each component from two vectors.
Scale
Vector2
Use to scale one vector by another, for example, to apply a non-uniform scale to a position or direction.

Additional resources