UKismetMathLibrary::NormalizeAxis
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Clamps an angle to the range [-180, 180] by wrapping. Useful for converting an absolute axis value into a signed delta that represents the shortest arc.
Caveats & Gotchas
- • Like ClampAxis, this wraps — it does not hard-clamp. 270 degrees maps to -90, not 180.
- • Internally calls ClampAxis first, so the full pipeline is: wrap to [0,360], then shift to [-180,180]. Very large inputs (millions of degrees) may accumulate floating-point error before normalization.
Signature
static ENGINE_API float NormalizeAxis(float Angle) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Angle | float | The angle in degrees to normalize. | — |
Return Type
float Example
Find shortest signed difference between two headings C++
float Delta = UKismetMathLibrary::NormalizeAxis(TargetYaw - CurrentYaw);
// Delta is in [-180, 180] — positive means turn right, negative means turn left. See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?