Normalize
Creates a normalized copy of the given vector.
阅读时间1 分钟最后更新于 1 个月前
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
Normalize(Vector2)
Creates a normalized copy of the given vector.
public static Vector2 Normalize(Vector2 value)
Parameters
The vector to normalize.
Returns
Type | Description |
|---|---|
| Vector2 | A new vector with the same direction as |
Normalize(Vector2)
Creates a normalized copy of the given vector.
public static Vector2 Normalize(in Vector2 value)
Parameters
The vector to normalize.
Returns
Type | Description |
|---|---|
| Vector2 | A new vector with the same direction as |
Normalize()
Makes this vector have a Vector2.magnitude of 1.
public void Normalize()
Remarks
When normalized, a vector keeps the same direction but its length is 1.0.
Note that this function will change the current vector. If you want to keep the current vector unchanged, use Vector2.normalized variable.
If this vector is too small to be normalized it will be set to zero.
Additional Resources: Vector2.normalized variable.