Math: Vector

Nodes in this category perform operations involving vec2 values (points or arrows in 2D space) such as the dot product, normalization, and distance calculations.

Nodes

NodeDetailsPossible Types
Angle Between

Calculates the angle swept between two vectors.

The value is always positive and ranges from 0° (both vectors point the same direction) to 180° (both vectors point opposite directions).

vec2 → f64
Angle To

Calculates the angle needed for a rightward-facing object placed at the observer position to turn so it points toward the target position.

vec2 → f64
transform → f64
Dot Product

The dot product operation (·) calculates the degree of similarity of a vec2 pair based on their angles and lengths.

Calculated as ‖a‖‖b‖cos(θ), it represents the product of their lengths (‖a‖‖b‖) scaled by the alignment of their directions (cos(θ)).

The output ranges from the positive to negative product of their lengths based on when they are pointing in the same or opposite directions.

If any vector has zero length, the output is 0.

vec2 → f64
Extract XY

Obtains the X or Y component of a vec2.

The inverse of this node is "Vec2 Value", which can have either or both its X and Y parameters exposed as graph inputs.

vec2 → f64
IVec2 → f64
UVec2 → f64
Length

The magnitude operator (‖x‖) calculates the length of a vec2, which is the distance from the base to the tip of the arrow represented by the vector.

vec2 → f64
Normalize

Scales the input vector to unit length while preserving its direction. This is equivalent to dividing the input vector by its own magnitude.

Returns 0 when the input vector has zero length.

vec2 → vec2