Skip to content

Vector4 Extension

Andrzej Kebab edited this page Feb 2, 2024 · 1 revision

UtilityLibrary.Unity.Runtime

Deconstruct & With

Deconstruct

Deconstructs a Vector4 instance into its individual components.

Vector4 vector = // initialize your Vector4
float x, y, z, w;
vector.Deconstruct(out x, out y, out z, out w);

Parameters:

  • vector: The Vector4 instance.

Outputs:

  • x: The x component of the Vector4.
  • y: The y component of the Vector4.
  • z: The z component of the Vector4.
  • w: The w component of the Vector4.

With

Creates a new Vector4 instance with the specified components, or the original components if not specified.

Vector4 originalVector = // initialize your Vector4
float? x = // optional
float? y = // optional
float? z = // optional
float? w = // optional
Vector4 newVector = originalVector.With(x, y, z, w);

Parameters:

  • originalVector: The original Vector4 instance.
  • x: The x component of the new Vector4. If null, the x component of the original Vector4 is used.
  • y: The y component of the new Vector4. If null, the y component of the original Vector4 is used.
  • z: The z component of the new Vector4. If null, the z component of the original Vector4 is used.
  • w: The w component of the new Vector4. If null, the w component of the original Vector4 is used.

Returns:

  • newVector: A new Vector4 instance with the specified components.

IsNaN

Checks if a Vector4 contains NaN values.

Vector4 vector = // initialize your Vector4
bool containsNaN = vector.IsNaN();

Parameters:

  • vector: The Vector4 instance.

Returns:

  • containsNaN: True if the Vector4 contains NaN values, false otherwise.

Clone this wiki locally