RealDocs

UKismetMathLibrary::VSizeSquared

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

Description

Returns the squared length of a 3D vector without a square root. Use this instead of VSize when you only need to compare magnitudes.

Caveats & Gotchas

  • The result is length-squared — compare against a squared threshold (Threshold * Threshold), not the raw threshold value.
  • Because there is no sqrt, the value grows quadratically. It cannot be used as a linear measure; e.g., doubling the vector quadruples the result.

Signature

static UE_INL_API double VSizeSquared(FVector A);

Parameters

Name Type Description Default
A FVector The vector whose squared length to compute.

Return Type

double

Example

Skip normalization when vector is already unit length C++
double LenSq = UKismetMathLibrary::VSizeSquared(Dir);
FVector SafeDir = (LenSq > SMALL_NUMBER) ? Dir / FMath::Sqrt(LenSq) : FVector::ZeroVector;

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.