RealDocs

UKismetMathLibrary::Matrix_GetScaledAxis

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

Description

Returns the requested row vector of the matrix, which carries both the direction and scale of that axis. Use this when you need to know how far the matrix stretches along a given direction.

Caveats & Gotchas

  • The returned vector's length equals the scale along that axis — it is NOT a unit vector. If you need only the direction, use Matrix_GetUnitAxis instead.
  • EAxis::None returns a zero vector; calling code should ensure a valid axis enum is passed.

Signature

static UE_INL_API FVector Matrix_GetScaledAxis(const FMatrix& M, TEnumAsByte<EAxis::Type> Axis)

Parameters

Name Type Description Default
M const FMatrix& The matrix to read the axis from.
Axis TEnumAsByte<EAxis::Type> Which axis to return: EAxis::X, EAxis::Y, or EAxis::Z.

Return Type

FVector

Example

Get the scaled forward vector of an actor's transform C++
FMatrix M = MyActor->GetTransform().ToMatrixWithScale();
FVector ScaledForward = UKismetMathLibrary::Matrix_GetScaledAxis(M, EAxis::X);
// Length of ScaledForward equals the X-axis scale of the actor

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.