RealDocs

UKismetMathLibrary::Matrix_RemoveScaling

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

Description

Normalises each row of the matrix in-place so that the magnitude of each row vector is 1, effectively stripping non-uniform scale while preserving rotation and translation. Assumes the matrix represents a transform.

Caveats & Gotchas

  • Modifies the matrix in-place — if you need the original matrix preserved, use Matrix_GetMatrixWithoutScale instead, which returns a new copy.
  • Rows with magnitude at or below Tolerance are not normalised, so a degenerate axis (zero-scale) survives unchanged rather than producing NaN. Downstream code should still validate for degenerate transforms.

Signature

static UE_INL_API void Matrix_RemoveScaling(UPARAM(Ref) FMatrix& M, float Tolerance = 1.e-8f)

Parameters

Name Type Description Default
M UPARAM(Ref) FMatrix& The matrix to modify in-place. Each row is normalised to unit length.
Tolerance float Rows whose magnitude is below this threshold are left as-is to avoid division by zero. 1.e-8f

Return Type

void

Example

Strip scale before extracting rotation C++
FMatrix M = SomeScaledTransform.ToMatrixWithScale();
UKismetMathLibrary::Matrix_RemoveScaling(M);
FRotator Rotation = UKismetMathLibrary::Matrix_GetRotator(M);

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.