Skip to main content

Vector2.ClampMagnitude(Vector2 vector, number maxLength)

Returns a copy of vector with its magnitude clamped to maxLength.

Parameters:

NameTypeDescription
vectorVector2vector
maxLengthnumbermaxLength

Returns:

typeDescription
Vector2a copy of vector with its magnitude clamped to maxLength.

Usage

---@type Vector2
local vector;

---@type number
local maxLength;


local val0 = Vector2:ClampMagnitude(vector, maxLength)