FMath::WindRelativeAnglesDegrees
#include "Math/UnrealMathUtility.h"
Access: public
Specifiers: static
Description
Adjusts InOutAngle1 so that the difference between it and InAngle0 is at most 180 degrees, preventing large jumps when interpolating rotation components converted from quaternions.
Caveats & Gotchas
- • This is specifically designed for Euler-angle interpolation after quaternion decomposition. If you are interpolating FRotator values directly, FRotator already handles winding internally — using this on top would double-wind.
- • A double overload exists (WindRelativeAnglesDegrees(double, double&)) for higher precision. Use it when working with double-precision rotations.
Signature
static CORE_API void WindRelativeAnglesDegrees(float InAngle0, float& InOutAngle1) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InAngle0 | float | The reference angle in degrees. | — |
| InOutAngle1 | float& | The second angle in degrees, wound in-place to avoid a >180 degree flip relative to InAngle0. | — |
Return Type
void Example
Wind a decomposed quaternion rotation before lerping C++
float PrevYaw = LastRotator.Yaw;
float NextYaw = CurrentRotator.Yaw;
FMath::WindRelativeAnglesDegrees(PrevYaw, NextYaw);
float SmoothedYaw = FMath::Lerp(PrevYaw, NextYaw, Alpha); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?