Documentation

Support

Unity Studio

Open Unity Studio

Unity Studio

Vector4 node

Use the Vector4 node to access preset 4D vector variables and common methods.
Read time 2 minutesLast updated 17 hours ago

The Vector4 node is a 4D vector toolbox for positions and directions (X, Y, Z, W) and vector methods.

Variables

Expand the Vector4 node to access the following preset variables:

Variable

Type

Description

one
Vector4
A vector with all components set to 1 (1, 1, 1, 1).
zero
Vector4
A vector with all components set to 0 (0, 0, 0, 0).
positiveInfinity
Vector4
A vector with all components set to positive infinity (∞, ∞, ∞, ∞).
negativeInfinity
Vector4
A vector with all components set to negative infinity (-∞, -∞, -∞, -∞).

Methods

Expand the Vector4 node to access the following methods:

Method

Return type

Description

Normalize
Vector4
A vector with a magnitude of 1, which points in the same direction as the original vector.
Distance
float
The distance between two points in 4D space, calculated as the magnitude of the difference between two vectors.
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 this to determine the angle between two vectors or to project one vector onto another.
Lerp
Vector4
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
Vector4
A vector that contains the maximum value of each component from two vectors.
Min
Vector4
A vector that contains the minimum value of each component from two vectors.
Scale
Vector4
Use to scale one vector by another, for example, to apply a non-uniform scale to a position or direction.
Magnitude
float
The length of the vector, calculated as the square root of the sum of the squares of its components. Use to determine how far a point is from the origin or to normalize a vector.
SqrMagnitude
float
The squared length of the vector, calculated as the sum of the squares of its components. You can use for performance optimization when you only need to compare magnitudes without needing the actual length.

Additional resources