Vector3 Abs()
static Vector3 Abs( Vector3& value )

book_4_sparkGenerated
code_blocksInput

Description

The Abs method of the Vector3 struct returns a new vector where each component is the absolute value of the corresponding component in the original vector. This means that any negative values in the vector are converted to positive values, while positive values remain unchanged.

Usage

Use the Abs method when you need to ensure that all components of a vector 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

Vector3 vector = new Vector3(-3.0f, 4.0f, -5.0f);
Vector3 absoluteVector = vector.Abs();
// absoluteVector is now (3.0f, 4.0f, 5.0f)