UKismetMathLibrary::VSize
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the length (magnitude) of a 3D vector. Equivalent to A.Size() or calling Vector_Distance with a zero origin.
Caveats & Gotchas
- • Involves a square root and is relatively expensive. Use VSizeSquared for comparisons to avoid the sqrt when an exact length value is not needed.
- • In Blueprint this is exposed as "Vector Length". C++ code should prefer the FVector member function A.Size() directly for clarity, reserving this function for Blueprint-facing API or generic utility code.
Signature
static UE_INL_API double VSize(FVector A); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FVector | The vector whose length to compute. | — |
Return Type
double Example
Check if a velocity vector exceeds max speed C++
double Speed = UKismetMathLibrary::VSize(Velocity);
if (Speed > MaxSpeed)
{
Velocity = Velocity.GetSafeNormal() * MaxSpeed;
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?