RealDocs

UKismetMathLibrary::EqualEqual_VectorVector

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

Description

Returns true if vectors A and B are equal within a per-component tolerance. The correct function to use when comparing vectors that result from floating-point calculations.

Caveats & Gotchas

  • The default tolerance of 1e-4 (0.0001 cm in UE's centimeter coordinate space) is appropriate for most gameplay comparisons, but may be too tight or too loose for physics, rendering, or large-world coordinates — always verify the right tolerance for your use case.
  • The tolerance is applied per component independently, not as a 3D distance check — two vectors can be within tolerance on each axis separately yet be farther apart in 3D space than you expect.

Signature

static UE_INL_API bool EqualEqual_VectorVector(FVector A, FVector B, float ErrorTolerance = 1.e-4f);

Parameters

Name Type Description Default
A FVector First vector.
B FVector Second vector.
ErrorTolerance float Maximum per-component absolute difference considered equal. 1.e-4f

Return Type

bool

Example

Check if actor has returned to its original position C++
FVector StartPos = FVector(100.f, 200.f, 0.f);
FVector CurrentPos = MyActor->GetActorLocation();
bool bAtStart = UKismetMathLibrary::EqualEqual_VectorVector(CurrentPos, StartPos, 1.f);

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.