UKismetMathLibrary::VSize2D
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns the Euclidean length (magnitude) of a 2D vector. Equivalent to calling A.Length() on the FVector2D member directly.
Caveats & Gotchas
- • Computing a vector length requires a square root. For distance comparisons, use VSize2DSquared and compare against the squared threshold to avoid the sqrt cost.
- • Returns a double; assigning to a float variable may introduce precision loss on very large coordinate values.
Signature
static UE_INL_API double VSize2D(FVector2D A); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FVector2D | The 2D vector whose length to compute. | — |
Return Type
double Example
Check if the player is within a 2D trigger radius C++
FVector2D Delta = FVector2D(PlayerPos) - FVector2D(TriggerPos);
double Dist = UKismetMathLibrary::VSize2D(Delta);
if (Dist < TriggerRadius)
ActivateTrigger(); Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?