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 | | A vector pointing in the downward direction (0, -1). |
| left | | A vector pointing in the left direction (-1, 0). |
| one | | A vector with all components set to 1 (1, 1). |
| right | | A vector pointing in the right direction (1, 0). |
| up | | A vector pointing in the upward direction (0, 1). |
| zero | | 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 | | 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 | | The distance between two points in 2D space. |
| Dot | | 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 | | 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 | | A vector that contains the maximum value of each component from two vectors. |
| Min | | A vector that contains the minimum value of each component from two vectors. |
| Scale | | Use to scale one vector by another, for example, to apply a non-uniform scale to a position or direction. |