ドキュメント

Unity Engine

Unity Engine

magnitude

Returns the length of this vector (Read Only).
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public readonly float magnitude { get; }

Remarks

The length of the vector is square root of
(x*x+y*y)
.
If you only need to compare magnitudes of some vectors, you can compare squared magnitudes of them using Vector2Int.sqrMagnitude (computing squared magnitudes is faster).
Additional Resources: Vector2Int.sqrMagnitude.