RealDocs

UKismetMathLibrary::Matrix_GetInverse

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

Description

Returns the inverse of the matrix. The header notes it handles nil (singular) matrices. Multiplying M by its inverse should yield the identity matrix.

Caveats & Gotchas

  • If the matrix is singular (determinant near zero), the result is a zero matrix (or may be undefined) rather than throwing. Always check Matrix_GetDeterminant first if you're not sure the matrix is invertible.
  • For pure rotation matrices (no scale, no shear), Matrix_GetTransposed is equivalent to the inverse but significantly cheaper — prefer it when you know the matrix is orthonormal.

Signature

static UE_INL_API FMatrix Matrix_GetInverse(const FMatrix& M)

Parameters

Name Type Description Default
M const FMatrix& The matrix to invert.

Return Type

FMatrix

Example

Build a world-to-local matrix from a local-to-world matrix C++
FMatrix LocalToWorld = Actor->GetActorTransform().ToMatrixWithScale();
FMatrix WorldToLocal = UKismetMathLibrary::Matrix_GetInverse(LocalToWorld);

// Convert a world-space point to local space
FVector4 LocalPoint = UKismetMathLibrary::Matrix_TransformPosition(WorldToLocal, WorldSpacePoint);

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.