UKismetMathLibrary::Matrix_RemoveTranslation
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns a copy of the matrix with its translation component zeroed out, leaving only the rotation and scale. Useful when you need to transform directions rather than points.
Caveats & Gotchas
- • Returns a new matrix rather than modifying in-place, so the original FMatrix is preserved — assign the result to a new variable.
- • Only the 4th column (translation) is zeroed. If the matrix was built with translation baked into row 3 via a non-standard convention, this function will not remove it correctly — it assumes the standard UE column-major layout.
Signature
static UE_INL_API FMatrix Matrix_RemoveTranslation(const FMatrix& M) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| M | const FMatrix& | The source matrix. Not modified. | — |
Return Type
FMatrix Example
Build a direction-only transform for lighting calculations C++
FMatrix FullTransform = LightActor->GetTransform().ToMatrixWithScale();
FMatrix DirectionOnly = UKismetMathLibrary::Matrix_RemoveTranslation(FullTransform);
FVector TransformedDir = DirectionOnly.TransformVector(FVector::ForwardVector); Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?