UKismetMathLibrary::Matrix_GetRotator
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Extracts and returns the rotation of the matrix as an FRotator (Pitch/Yaw/Roll in degrees). Assumes the matrix represents a transform and that the rotation rows have unit length.
Caveats & Gotchas
- • If the matrix has non-unit-length rows (i.e., contains scale), call Matrix_GetMatrixWithoutScale first — otherwise the extracted rotator may be incorrect due to scale being incorporated into the row vectors.
- • FRotator suffers from gimbal lock and cannot represent all rotations unambiguously near ±90° pitch. For interpolation or compound rotations, convert to FQuat via Matrix_ToQuat instead.
Signature
static UE_INL_API FRotator Matrix_GetRotator(const FMatrix& M) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| M | const FMatrix& | The matrix to extract rotation from. Should represent a transform with unit-length rotation rows. | — |
Return Type
FRotator Example
Read rotation from a raw matrix after stripping scale C++
FMatrix M = MyActor->GetTransform().ToMatrixWithScale();
FMatrix Unscaled = UKismetMathLibrary::Matrix_GetMatrixWithoutScale(M);
FRotator Rotation = UKismetMathLibrary::Matrix_GetRotator(Unscaled); Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?