Description
The Vector3.Sort
method is a static method that takes two Vector3
references as parameters, min
and max
. It sorts the components of these vectors such that the min
vector contains the minimum values for each component, and the max
vector contains the maximum values for each component. This is useful for ensuring that a pair of vectors represent a valid bounding box or range in 3D space.
Usage
To use the Vector3.Sort
method, you need to pass two Vector3
variables by reference. After the method call, the first variable will contain the minimum values and the second variable will contain the maximum values for each component.
Example
Vector3 a = new Vector3(3, 5, 1);
Vector3 b = new Vector3(2, 4, 6);
Vector3.Sort(ref a, ref b);
// After sorting:
// a will be (2, 4, 1)
// b will be (3, 5, 6)