UKismetMathLibrary::Quat_GetRotationAxis
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the unit vector axis around which this quaternion rotates. For the identity quaternion (no rotation), returns FVector(1,0,0) as a defined fallback.
Caveats & Gotchas
- • The identity quaternion has no meaningful rotation axis, so the engine returns FVector(1,0,0) rather than a zero vector. Check Quat_GetAngle before using this axis if you need to distinguish 'no rotation' from 'rotating around X'.
- • This axis together with Quat_GetAngle gives the axis-angle representation of the quaternion. For the full decomposition, use both functions — do not assume the axis encodes magnitude.
Signature
static UE_INL_API FVector Quat_GetRotationAxis(const FQuat& Q); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Q | const FQuat& | The quaternion to extract the rotation axis from. | — |
Return Type
FVector Example
Extract axis-angle for procedural animation C++
FQuat TwistQuat = GetComponentQuat();
FVector Axis = UKismetMathLibrary::Quat_GetRotationAxis(TwistQuat);
float Angle = UKismetMathLibrary::Quat_GetAngle(TwistQuat);
UE_LOG(LogTemp, Display, TEXT("Rotating %.1f deg around (%s)"),
FMath::RadiansToDegrees(Angle), *Axis.ToString()); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?