UKismetMathLibrary::Quat_ToRotationVector
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns the rotation vector corresponding to this quaternion, where the direction is the rotation axis and the magnitude is the angle in degrees. Useful for blending rotations in angular-velocity space.
Caveats & Gotchas
- • The magnitude of the result is in degrees, not radians. Multiplying by PI/180 is required if you need radians for physics calculations.
- • For the identity quaternion the returned vector is (0,0,0); direction is undefined, so be careful when normalizing the result.
Signature
static UE_INL_API FVector Quat_ToRotationVector(const FQuat& Q); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Q | const FQuat& | The quaternion to convert to a rotation vector. | — |
Return Type
FVector Example
Convert quaternion to rotation vector and back C++
FQuat Q = GetActorQuat();
FVector RotVec = UKismetMathLibrary::Quat_ToRotationVector(Q);
// RotVec.Size() == rotation angle in degrees
// RotVec.GetSafeNormal() == rotation axis
FQuat Rebuilt = UKismetMathLibrary::Quat_MakeFromRotationVector(RotVec);
// Rebuilt should match Q Tags
Version History
Introduced in: 4.20
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?