UKismetMathLibrary::Vector4_IsNAN
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns true if any of the four components of A is NaN (Not a Number). Use this to validate vectors that result from division or other operations that can produce NaN.
Caveats & Gotchas
- • Returns true if ANY component is NaN — it is not a per-component check. You cannot tell from the return value which component is bad; log or inspect components individually for diagnostics.
- • This does not check for Inf. A vector with an infinite component (from division by zero returning Inf rather than NaN) will return false here. Use a separate IsFinite check if you also need to guard against Inf.
Signature
static UE_INL_API bool Vector4_IsNAN(const FVector4& A) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | const FVector4& | The vector to check. | — |
Return Type
bool Example
Validate result of divide before use C++
FVector4 Result = UKismetMathLibrary::Divide_Vector4Vector4(Numerator, Denominator);
if (UKismetMathLibrary::Vector4_IsNAN(Result))
{
UE_LOG(LogTemp, Warning, TEXT("Divide produced NaN — check Denominator"));
Result = FVector4::Zero();
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?