UKismetMathLibrary::ComposeRotators
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Combines two rotators into a single rotator that represents applying A first, then B. Uses quaternion multiplication internally to avoid gimbal lock.
Caveats & Gotchas
- • The operation is not commutative — ComposeRotators(A, B) is not the same as ComposeRotators(B, A). A is applied first in local space, then B is applied in the resulting frame.
- • Component-wise addition (A + B) is NOT equivalent to composing rotations — use this function instead of the + operator when you need correct sequential rotation composition.
Signature
static ENGINE_API FRotator ComposeRotators(FRotator A, FRotator B); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FRotator | First rotation to apply. | — |
| B | FRotator | Second rotation to apply after A. | — |
Return Type
FRotator Example
Apply a local pitch offset on top of the actor world rotation C++
FRotator WorldRot = GetActorRotation();
FRotator PitchOffset(15.f, 0.f, 0.f);
FRotator Combined = UKismetMathLibrary::ComposeRotators(WorldRot, PitchOffset);
SetActorRotation(Combined); Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?