Table of Contents

Method ClampMagnitude

Namespace
Gamelogic.Extensions
Assembly
Gamelogic.Extensions.dll

ClampMagnitude(Vector4, float)

Clamps the vector to the given magnitude.

public static Vector4 ClampMagnitude(this Vector4 vector, float maxLength)

Parameters

vector Vector4

The vector to clamp.

maxLength float

The maximum length of the vector.

Returns

Vector4

The clamped vector.

Remarks

Unity provides ClampMagnitude for Vector2, and Vector3: ClampMagnitude(Vector2, float) and ClampMagnitude(Vector3, float). This method provides the same functionality for Vector4.