UKismetMathLibrary::Vector_IsNormal
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns true if the vector is normalized (unit length). Uses a tolerance of 1.e-4 on the squared length, so vectors very close to unit length also return true.
Caveats & Gotchas
- • The check is done on the squared length, so the actual tolerance on length is the square root of 1.e-4 (~0.01). A vector with length 0.99 or 1.01 will still pass.
- • This function does NOT normalize the vector — it only queries whether it already is. Call Normal() or Vector_Normalize() first if you need to ensure it's unit length before using it as a direction.
Signature
static UE_INL_API bool Vector_IsNormal(const FVector& A); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | const FVector& | The vector to test. | — |
Return Type
bool Example
Guard normalization before use C++
FVector Dir = SomeInput.GetSafeNormal();
if (UKismetMathLibrary::Vector_IsNormal(Dir))
{
// safe to use as direction
MoveActor(Dir * Speed);
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?