RealDocs

UKismetMathLibrary::VSizeXYSquared

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

Description

Returns the squared length of a 3D vector's XY components without a square root. The most efficient option for top-down magnitude comparisons.

Caveats & Gotchas

  • Z is ignored. Combine with a separate Z check if you need to validate both horizontal and vertical constraints simultaneously.
  • Result is length-squared in the XY plane — compare against Threshold * Threshold, not the raw threshold. Mixing squared and unsquared comparisons is a frequent source of subtle gameplay bugs.

Signature

static UE_INL_API double VSizeXYSquared(FVector A);

Parameters

Name Type Description Default
A FVector The 3D vector whose squared XY-plane length to compute.

Return Type

double

Example

Check horizontal speed cap efficiently C++
double HorizSpeedSq = UKismetMathLibrary::VSizeXYSquared(CharacterMovement->Velocity);
if (HorizSpeedSq > MaxHorizSpeed * MaxHorizSpeed)
{
    // clamp horizontal velocity
}

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.