UKismetMathLibrary::Matrix_TransformPosition
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Transforms a 3D position vector by the matrix, including the translation component. Returns an FVector4 (homogeneous result). Equivalent to multiplying FVector4(V, 1) by the matrix.
Caveats & Gotchas
- • The return type is FVector4, not FVector. If you need a 3D position back, extract XYZ from the result (W should be 1 for a non-projective transform matrix, but check it).
- • Unlike Matrix_TransformVector, this includes translation — use it for points in space, not for direction vectors (where translation should be ignored).
Signature
static UE_INL_API FVector4 Matrix_TransformPosition(const FMatrix& M, FVector V) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| M | const FMatrix& | The transform matrix to apply. | — |
| V | FVector | The 3D position to transform. Internally treated as a homogeneous point (W=1). | — |
Return Type
FVector4 Example
Transform a world position by a local-to-world matrix C++
FVector LocalPoint(100.f, 0.f, 50.f);
FVector4 WorldPoint4 = UKismetMathLibrary::Matrix_TransformPosition(LocalToWorldMatrix, LocalPoint);
FVector WorldPoint(WorldPoint4.X, WorldPoint4.Y, WorldPoint4.Z); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?