Api > Vector3 > ClampMagnitude()
Vector3.ClampMagnitude(Vector3 vector, number maxLength)⚓︎
Returns a copy of vector with its magnitude clamped to maxLength.
Parameters:⚓︎
Name | Type | Description |
---|---|---|
vector | Vector3 | |
maxLength | number | max Length |
Returns:⚓︎
type | Description |
---|---|
Vector3 | a copy of vector with its magnitude clamped to maxLength. |
Usage⚓︎
---@type Vector3
local vector;
---@type number
local maxLength;
local val0 = Vector3:ClampMagnitude(vector, maxLength)