UKismetMathLibrary::RotatorFromAxisAndAngle
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Creates an FRotator representing a rotation of Angle degrees around the given Axis. Internally converts to quaternion and back, producing a valid Euler decomposition.
Caveats & Gotchas
- • The round-trip through FQuat means the Pitch/Yaw/Roll values may look unexpected for diagonal axes. A 45-degree rotation around a diagonal axis does not yield a simple 45° in one Euler slot.
- • Angle is float, not double — this is inconsistent with most UE5 math functions that accept double. Casting from a double variable before passing avoids warnings.
- • Passing a zero-length Axis produces a degenerate rotation; Unreal silently returns identity in this case, which may hide logic errors.
Signature
static ENGINE_API FRotator RotatorFromAxisAndAngle(FVector Axis, float Angle); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Axis | FVector | The rotation axis. Does not need to be pre-normalized. | — |
| Angle | float | The rotation angle in degrees. | — |
Return Type
FRotator Example
Rotate an actor around an arbitrary axis C++
FVector SpinAxis = FVector(1.f, 1.f, 0.f).GetSafeNormal();
FRotator SpinRot = UKismetMathLibrary::RotatorFromAxisAndAngle(SpinAxis, 45.f);
Actor->AddActorLocalRotation(SpinRot); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?