RealDocs

UKismetMathLibrary::Quat_Normalize

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

Description

Normalizes the quaternion in-place so its magnitude equals 1. If the squared length is less than Tolerance, the quaternion is set to the identity quaternion instead of dividing by near-zero.

Caveats & Gotchas

  • The Tolerance parameter is compared against the squared length, not the length itself. The default 1e-4 means any quaternion with length < 0.01 is replaced by identity — much larger than you might expect if you're thinking in linear units.
  • Calling this every frame on a quaternion that accumulates multiplications is good practice. Floating-point drift causes unit quaternions to slowly grow un-normalized, leading to scale artifacts in the rotated vectors.

Signature

static UE_INL_API void Quat_Normalize(UPARAM(ref) FQuat& Q, float Tolerance = 1.e-4f);

Parameters

Name Type Description Default
Q FQuat& The quaternion to normalize in-place.
Tolerance float Minimum squared length required for normalization; quaternions below this are reset to identity. 1.e-4f

Return Type

void

Example

Re-normalize after accumulating rotations C++
// Accumulate rotation delta over many frames
AccumulatedQuat *= DeltaQuat;

// Renormalize periodically to prevent drift
if (FrameCount % 10 == 0)
{
    UKismetMathLibrary::Quat_Normalize(AccumulatedQuat);
}

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.