UKismetMathLibrary::ClampAxis
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Clamps an angle to the range [0, 360]. Any angle outside this range is wrapped into it, not simply hard-clamped.
Caveats & Gotchas
- • This wraps the angle rather than hard-clamping: passing 361 returns 1, not 360. If you need a hard clamp use FMath::Clamp directly.
- • Result is always in [0, 360), not [0, 360] — the value 360 itself maps to 0 due to the modulo operation.
Signature
static ENGINE_API float ClampAxis(float Angle) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Angle | float | The angle in degrees to clamp. | — |
Return Type
float Example
Normalize a camera yaw before storing C++
float RawYaw = SomePitch - 400.f;
float ClampedYaw = UKismetMathLibrary::ClampAxis(RawYaw); // 320.0f See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?