Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Vector2.ClampMagnitude

static function ClampMagnitude(vector: Vector2, maxLength: float): Vector2;
static Vector2 ClampMagnitude(Vector2 vector, float maxLength);
static def ClampMagnitude(vector as Vector2, maxLength as float) as Vector2

Description

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