UKismetMathLibrary::Vector_Distance
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the Euclidean distance between two 3D points. Equivalent to (V2 - V1).Size().
Caveats & Gotchas
- • Involves a square root and is more expensive than Vector_DistanceSquared. For distance comparisons (e.g., "is the enemy within range?"), prefer the squared variant to avoid the sqrt.
- • Returns a double — in pre-UE5 projects compiled with 32-bit FVector (CORE_API double is only guaranteed in UE 5.x), the result precision depends on the engine version.
Signature
static UE_INL_API double Vector_Distance(FVector V1, FVector V2); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| V1 | FVector | The first point. | — |
| V2 | FVector | The second point. | — |
Return Type
double Example
Check if a pickup is within interaction range C++
double Dist = UKismetMathLibrary::Vector_Distance(
Player->GetActorLocation(),
Pickup->GetActorLocation());
if (Dist <= InteractRange)
{
Pickup->Collect(Player);
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?