UKismetMathLibrary::Matrix_TransformVector
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Transforms a direction vector by the matrix without applying the translation component. Use for normals, velocity directions, and axes — not for positions.
Caveats & Gotchas
- • Translation is ignored (W=0 implicit). If you accidentally call this on a position instead of a direction, the result will be missing the translation offset — use Matrix_TransformPosition for points.
- • The return type is FVector4. The W component of the result should be 0 for a pure transform matrix, but callers should not rely on this for projection matrices. Extract XYZ explicitly.
Signature
static UE_INL_API FVector4 Matrix_TransformVector(const FMatrix& M, FVector V) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| M | const FMatrix& | The transform matrix. | — |
| V | FVector | The direction vector to transform. Translation is not applied. | — |
Return Type
FVector4 Example
Rotate a velocity vector into world space C++
FVector LocalVelocity(0.f, 200.f, 0.f);
FMatrix LocalToWorld = Actor->GetActorTransform().ToMatrixWithScale();
FVector4 WorldVel4 = UKismetMathLibrary::Matrix_TransformVector(LocalToWorld, LocalVelocity);
FVector WorldVelocity(WorldVel4.X, WorldVel4.Y, WorldVel4.Z); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?