UKismetMathLibrary::NegateRotator
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns a rotator with all three components negated (Pitch, Yaw, Roll each multiplied by -1). In Blueprint this is exposed as 'Invert Rotator'.
Caveats & Gotchas
- • Component negation is not the same as the inverse rotation. For a true inverse (the rotation that undoes A), convert to a quaternion and use its inverse, or use NormalizedDeltaRotator(ZeroRotator, A). NegateRotator is only correct for inverting pure single-axis rotations.
- • Negating a rotator that has non-zero values on more than one axis will generally not produce a rotation that 'undoes' the original due to how Euler-angle composition works.
Signature
static UE_INL_API FRotator NegateRotator(FRotator A); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FRotator | The rotator to negate. | — |
Return Type
FRotator Example
Mirror a yaw-only rotation C++
// For single-axis rotations, negation gives the reverse direction
FRotator Yaw90(0.f, 90.f, 0.f);
FRotator Yaw90Reversed = UKismetMathLibrary::NegateRotator(Yaw90);
// Yaw90Reversed == FRotator(0, -90, 0) Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?