Normalize
Returns a normalized vector based on the given vector. The normalized vector has a Vector4.magnitude of 1 and is in the same direction as the given vector. Returns a zero vector if the given vector is too small to be normalized.
Read time 2 minutesLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
Normalize(Vector4)
Returns a normalized vector based on the given vector. The normalized vector has a Vector4.magnitude of 1 and is in the same direction as the given vector. Returns a zero vector if the given vector is too small to be normalized.
public static Vector4 Normalize(Vector4 a)
Parameters
The vector to be normalized.
Returns
Type | Description |
|---|---|
| Vector4 | A new vector with the same direction as the original vector but with a magnitude of 1.0. |
Remarks
Note that this does not modify the given vector. To modify and normalize the current vector, use the Vector4.Normalize function without a parameter.
Additional Resources: Vector4.normalized function.
Normalize(Vector4)
Returns a normalized vector based on the given vector. The normalized vector has a Vector4.magnitude of 1 and is in the same direction as the given vector. Returns a zero vector if the given vector is too small to be normalized.
public static Vector4 Normalize(in Vector4 a)
Parameters
The vector to be normalized.
Returns
Type | Description |
|---|---|
| Vector4 | A new vector with the same direction as the original vector but with a magnitude of 1.0. |
Remarks
Note that this does not modify the given vector. To modify and normalize the current vector, use the Vector4.Normalize function without a parameter.
Additional Resources: Vector4.normalized function.
Normalize()
Makes this vector have a Vector4.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 Vector4.normalized variable.
If this vector is too small to be normalized it will be set to zero.
Additional Resources: Vector4.normalized property.