RealDocs

FVector::IsZero

function Core Since unknown
#include "Math/Vector.h"
Access: public Specifiers: const

Description

Returns true if all three components are exactly zero. Performs no floating-point tolerance — use IsNearlyZero() for practical zero checks.

Signature

bool IsZero() const

Return Type

bool

Caveats & Gotchas

  • Exact zero comparison — any floating-point arithmetic on a previously-zero vector can produce a non-zero result (e.g. 0.0f + tiny_epsilon). In practice, IsNearlyZero() is almost always more appropriate.
  • FVector::ZeroVector is guaranteed to be exactly (0, 0, 0), so IsZero() is reliable for detecting default-initialised or explicitly zeroed vectors.

Example

Check for a deliberately unset vector C++
// Detect that no override direction was set (explicit zero sentinel)
if (OverrideDirection.IsZero())
{
	// Fall back to actor's forward vector
	OverrideDirection = GetActorForwardVector();
}

Tags

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.