UKismetMathLibrary::Quat_Normalized
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns a normalized copy of the quaternion without modifying the original. If the squared length is below Tolerance, returns the identity quaternion.
Caveats & Gotchas
- • Prefer Quat_Normalize (in-place) over this function in hot paths — the copy avoids a small allocation but still costs the normalization math. Use Quat_Normalized when you need to preserve the original for comparison or rollback.
- • Like Quat_Normalize, the Tolerance is applied to the squared length. A quaternion with length 0.009 will be replaced by identity even though it appears non-zero.
Signature
static UE_INL_API FQuat Quat_Normalized(const FQuat& Q, float Tolerance = 1.e-4f); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Q | const FQuat& | The quaternion to get a normalized copy of. | — |
| Tolerance | float | Minimum squared length; quaternions below this return identity. | 1.e-4f |
Return Type
FQuat Example
Normalize before using in rotation math C++
// User-supplied quaternion data may not be unit length
FQuat UserQuat = LoadQuatFromSaveData();
FQuat SafeQuat = UKismetMathLibrary::Quat_Normalized(UserQuat);
FVector Forward = UKismetMathLibrary::Quat_GetAxisX(SafeQuat); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?