文档

Unity Engine

Unity Engine

ClampMagnitude

Creates a copy of a given vector, with its magnitude clamped to a maximum length.
阅读时间1 分钟最后更新于 1 个月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule

ClampMagnitude(Vector2, float)

Creates a copy of a given vector, with its magnitude clamped to a maximum length.
public static Vector2 ClampMagnitude(Vector2 vector, float maxLength)

Parameters

vector

The vector to clamp.

maxLength

The maximum length to clamp the vector to.

Returns

Type

Description

Vector2A copy of
vector
with its magnitude clamped to
maxLength
.

ClampMagnitude(Vector2, float)

Creates a copy of a given vector, with its magnitude clamped to a maximum length.
public static Vector2 ClampMagnitude(in Vector2 vector, float maxLength)

Parameters

vector

The vector to clamp.

maxLength

The maximum length to clamp the vector to.

Returns

Type

Description

Vector2A copy of
vector
with its magnitude clamped to
maxLength
.