RealDocs

UKismetMathLibrary::Vector_Distance2D

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

Description

Returns the Euclidean distance between two points in the XY plane, ignoring the Z component. Both inputs are still FVector (3D), but only X and Y are used in the calculation.

Caveats & Gotchas

  • The Z component is completely ignored — two actors at very different heights appear at the same 2D distance. This is the desired behaviour for top-down range checks, but incorrect for 3D proximity tests.
  • Involves a square root. Use Vector_Distance2DSquared for range comparisons to avoid the sqrt cost.

Signature

static UE_INL_API double Vector_Distance2D(FVector V1, FVector V2);

Parameters

Name Type Description Default
V1 FVector The first point.
V2 FVector The second point.

Return Type

double

Example

Top-down range check ignoring height C++
double Dist2D = UKismetMathLibrary::Vector_Distance2D(
    GetActorLocation(),
    TargetActor->GetActorLocation());
if (Dist2D <= ActivationRadius)
{
    ActivateTrap();
}

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.