RealDocs

UKismetMathLibrary::Matrix_InverseTransformPosition

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Transforms a position vector by the inverse of the matrix, correctly handling scale. Converts a world-space point into the local space defined by the matrix.

Caveats & Gotchas

  • This internally computes the matrix inverse on every call. If you need to inverse-transform many vectors by the same matrix, cache the inverse with Matrix_GetInverse and call Matrix_TransformPosition instead.
  • The comment in the header says it 'correctly handles scaling in this matrix' — meaning it uses a full inverse, not a transpose. For unscaled orthogonal matrices the transpose is equivalent and faster; use that when scale is known to be 1.

Signature

static UE_INL_API FVector Matrix_InverseTransformPosition(const FMatrix& M, FVector V)

Parameters

Name Type Description Default
M const FMatrix& The transform matrix to invert before applying.
V FVector The world-space position to transform into local space.

Return Type

FVector

Example

Convert a world hit location into an actor's local space C++
FMatrix ActorWorldMatrix = Actor->GetActorTransform().ToMatrixWithScale();
FVector LocalHit = UKismetMathLibrary::Matrix_InverseTransformPosition(ActorWorldMatrix, HitResult.Location);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.