The ComponentMax
method of the Vector3
struct returns a new Vector3
instance where each component is the maximum of the corresponding components of the current vector and another specified vector.
The ComponentMax
method of the Vector3
struct returns a new Vector3
instance where each component is the maximum of the corresponding components of the current vector and another specified vector.
Use this method when you need to create a new vector that represents the component-wise maximum of two vectors. This can be useful in scenarios where you want to ensure that each component of a vector is at least as large as the corresponding component of another vector.
Vector3 vector1 = new Vector3(1.0f, 3.0f, 5.0f); Vector3 vector2 = new Vector3(2.0f, 2.0f, 6.0f); Vector3 result = vector1.ComponentMax(ref vector2); // result is now (2.0f, 3.0f, 6.0f)