Description
The Vector3.Sort
method is a static utility function that ensures the components of two Vector3
instances are sorted in ascending order. This method modifies the input vectors min
and max
such that for each component, the value in min
is less than or equal to the corresponding value in max
.
Usage
To use the Vector3.Sort
method, pass two Vector3
references as parameters. The method will adjust these vectors in place, ensuring that the min
vector has the smallest components and the max
vector has the largest components for each axis.
Example
Vector3 min = new Vector3(3, 1, 5);
Vector3 max = new Vector3(2, 4, 1);
// Before sorting:
// min = (3, 1, 5)
// max = (2, 4, 1)
Vector3.Sort(ref min, ref max);
// After sorting:
// min = (2, 1, 1)
// max = (3, 4, 5)