RealDocs

UKismetMathLibrary::IsZero2D

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

Description

Returns true only if both X and Y are exactly 0.0. This is an exact bitwise check — use IsNearlyZero2D for floating-point safety.

Caveats & Gotchas

  • Floating-point arithmetic almost never produces a perfectly exact zero. A vector set by arithmetic operations (e.g., subtraction or interpolation) will rarely pass this check. Use IsNearlyZero2D in nearly all runtime contexts.
  • Valid use cases for IsZero2D are when you explicitly set a vector to FVector2D::ZeroVector or FVector2D(0, 0) and need to confirm it hasn't been modified.

Signature

static UE_INL_API bool IsZero2D(const FVector2D& A);

Parameters

Name Type Description Default
A const FVector2D& The 2D vector to check.

Return Type

bool

Example

Detect an uninitialised direction vector C++
FVector2D InputDir = GetRawInputDirection();
if (UKismetMathLibrary::IsZero2D(InputDir))
{
    // No input this frame
    return;
}

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.