RealDocs

UKismetMathLibrary::EqualEqual_Vector4Vector4

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

Description

Returns true if all four components of A and B differ by no more than ErrorTolerance. The default tolerance of 1e-4 is suitable for most world-space comparisons.

Caveats & Gotchas

  • ErrorTolerance is applied per-component, not to the Euclidean distance between the vectors. Two vectors that are within tolerance on each axis individually may still represent visually different directions.
  • The default tolerance of 1e-4 was designed for centimetre-scale world coordinates. For normalised vectors (components in [-1, 1]) this tolerance may be too loose; consider using a smaller value like 1e-6.

Signature

static UE_INL_API bool EqualEqual_Vector4Vector4(const FVector4& A, const FVector4& B, float ErrorTolerance = 1.e-4f)

Parameters

Name Type Description Default
A const FVector4& First vector.
B const FVector4& Second vector to compare.
ErrorTolerance float Maximum per-component absolute difference allowed before vectors are considered unequal. 1.e-4f

Return Type

bool

Example

Fuzzy equality check on computed vectors C++
FVector4 Expected(0.0, 0.0, 1.0, 0.0);
FVector4 Computed = SomeFunction();
if (UKismetMathLibrary::EqualEqual_Vector4Vector4(Computed, Expected, 1e-5f))
{
    // close enough
}

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.