RealDocs

UKismetMathLibrary::Quat_Size

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

Description

Returns the length (Euclidean norm) of the quaternion as a scalar. A valid unit quaternion representing a pure rotation has a size of exactly 1.0.

Caveats & Gotchas

  • Calling Quat_Size involves a square root; prefer Quat_SizeSquared when only comparing magnitudes to avoid the extra cost.
  • Quaternions accumulate floating-point drift over many multiplications and will eventually deviate from unit length. Use FQuat::Normalize or check Quat_Size periodically in long-running simulations.

Signature

static UE_INL_API float Quat_Size(const FQuat& Q);

Parameters

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

Return Type

float

Example

Verify quaternion is normalized before use C++
FQuat Q = GetActorQuat();
float Size = UKismetMathLibrary::Quat_Size(Q);
if (!FMath::IsNearlyEqual(Size, 1.f, 1e-4f))
{
    Q.Normalize();
    SetActorRotation(Q.Rotator());
}

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.