UKismetMathLibrary::Matrix_GetUnitAxes
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Retrieves all three unit-length axis direction vectors of the matrix in a single call. Equivalent to calling Matrix_GetUnitAxis three times but more efficient.
Caveats & Gotchas
- • Each row is independently normalised — if the matrix contains non-orthogonal (sheared) rows, the output unit vectors will not be orthogonal to each other, which can be surprising if you expected a pure rotation.
- • Axes whose row magnitude is zero (zero-scale axis) will produce a zero output vector without a warning. Always validate inputs from untrusted sources.
Signature
static UE_INL_API void Matrix_GetUnitAxes(const FMatrix& M, FVector &X, FVector &Y, FVector &Z) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| M | const FMatrix& | The matrix to read axes from. | — |
| X | FVector& | Output: the unit-length X axis direction. | — |
| Y | FVector& | Output: the unit-length Y axis direction. | — |
| Z | FVector& | Output: the unit-length Z axis direction. | — |
Return Type
void Example
Compute the local coordinate frame of a transform C++
FMatrix M = MyComponent->GetComponentTransform().ToMatrixWithScale();
FVector Right, Up, Forward;
UKismetMathLibrary::Matrix_GetUnitAxes(M, Forward, Right, Up);
// Forward = X, Right = Y, Up = Z in UE's left-handed coordinate system Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?