UKismetMathLibrary::EqualEqual_Vector2DVector2D
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns true if vector A is approximately equal to vector B within a per-component error tolerance. This is the correct equality check for vectors produced by arithmetic.
Caveats & Gotchas
- • The default tolerance of 1e-4 is suitable for most gameplay comparisons, but may be too loose for precise UV or pixel-space operations. Pass a smaller tolerance when precision matters.
- • The check is per-component: both |A.X - B.X| and |A.Y - B.Y| must be within tolerance. A vector that is 'close' in distance can still fail this check if one axis is exactly at the tolerance boundary.
Signature
static UE_INL_API bool EqualEqual_Vector2DVector2D(FVector2D A, FVector2D B, float ErrorTolerance = 1.e-4f); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FVector2D | The first vector. | — |
| B | FVector2D | The second vector. | — |
| ErrorTolerance | float | The maximum allowed difference per component for the vectors to be considered equal. | 1.e-4f |
Return Type
bool Example
Check if two UI positions converged C++
FVector2D Target(100.f, 200.f);
FVector2D Current = InterpolatedPos;
bool bArrived = UKismetMathLibrary::EqualEqual_Vector2DVector2D(Current, Target, 1.f);
// Returns true when within 1 unit on each axis See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?