RealDocs

UKismetMathLibrary::Matrix_GetScaleVector

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

Description

Returns the per-axis scale encoded in the matrix by computing the magnitude of each of the three row vectors. Assumes the matrix represents a transform.

Caveats & Gotchas

  • Scale is always returned as positive magnitudes. If the matrix encodes a reflection (negative determinant), the returned scale vector will still have positive components — you cannot distinguish a reflection from a normal positive scale with this function alone.
  • Sheared matrices (non-orthogonal rows) produce scale values that are row magnitudes, not the intuitive uniform scale factors; the result may be misleading if the matrix was not constructed from a clean TRS decomposition.

Signature

static UE_INL_API FVector Matrix_GetScaleVector(const FMatrix& M, float Tolerance = 1.e-8f)

Parameters

Name Type Description Default
M const FMatrix& The matrix to extract scale from.
Tolerance float Axes with magnitude below this value return 0 for that component instead of a near-zero garbage value. 1.e-8f

Return Type

FVector

Example

Read current world scale of an actor C++
FMatrix WorldMat = MyActor->GetTransform().ToMatrixWithScale();
FVector Scale3D = UKismetMathLibrary::Matrix_GetScaleVector(WorldMat);
UE_LOG(LogTemp, Log, TEXT("Scale: %s"), *Scale3D.ToString());

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.