UKismetMathLibrary::NormalizedDeltaRotator
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the normalized difference (A - B) with each component clamped to [-180, 180]. Use this to compute the angular delta between two rotations without 360° wrap-around artifacts.
Caveats & Gotchas
- • The result is A minus B, not B minus A — easy to confuse. If you want the rotation to apply to B to reach A, the result is NormalizedDeltaRotator(A, B).
- • Like other rotator math, this is per-Euler-component and not a true rotation-space inverse. For combined multi-axis deltas (e.g. both pitch and yaw differ), the delta may not compose back cleanly via ComposeRotators due to gimbal effects.
Signature
static ENGINE_API FRotator NormalizedDeltaRotator(FRotator A, FRotator B); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FRotator | The target rotation. | — |
| B | FRotator | The base rotation to subtract. | — |
Return Type
FRotator Example
Compute angular error for a rotation controller C++
FRotator Error = UKismetMathLibrary::NormalizedDeltaRotator(TargetRotation, CurrentRotation);
// Error.Yaw is now in [-180, 180] — safe to use as a PID input
float YawCorrection = Error.Yaw * YawGain; Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?