Description
The Abs
method of the Vector3Int
struct returns a new Vector3Int
instance where each component of the vector is the absolute value of the corresponding component in the original vector. This means that any negative values in the vector are converted to their positive counterparts.
Usage
Use the Abs
method when you need to ensure that all components of a Vector3Int
are non-negative. This can be useful in scenarios where directionality is not important, and you are only interested in the magnitude of each component.
Example
Vector3Int vector = new Vector3Int(-3, 4, -5);
Vector3Int absoluteVector = vector.Abs();
// absoluteVector is now (3, 4, 5)