RealDocs

UKismetMathLibrary::Quat_SizeSquared

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

Description

Returns the squared length of the quaternion without computing a square root. Cheaper than Quat_Size and sufficient for comparing magnitudes or checking normalization.

Caveats & Gotchas

  • A unit quaternion has a squared size of 1.0. Comparing against 1.0 with a small epsilon (e.g. 1e-6) is more reliable than checking Quat_Size == 1.0 due to floating-point arithmetic.
  • The return type is float even though the internal FQuat components are doubles in UE5. Precision loss can occur for very large component values.

Signature

static UE_INL_API float Quat_SizeSquared(const FQuat& Q);

Parameters

Name Type Description Default
Q const FQuat& The quaternion whose squared length to compute.

Return Type

float

Example

Fast normalization check using squared size C++
FQuat Q = GetActorQuat();
float SizeSq = UKismetMathLibrary::Quat_SizeSquared(Q);
if (FMath::Abs(SizeSq - 1.f) > 1e-4f)
{
    UE_LOG(LogTemp, Warning, TEXT("Quaternion has drifted: SizeSq=%f"), SizeSq);
}

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.