RealDocs

UKismetMathLibrary::Vector4_Size

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

Description

Returns the Euclidean length (magnitude) of a FVector4 including all four components: sqrt(X²+Y²+Z²+W²).

Caveats & Gotchas

  • All four components contribute including W. If your Vector4 holds a 3D direction with W=0, this is equivalent to Vector4_Size3 and either can be used. But if W is non-zero (e.g., a quaternion or homogeneous point), the result is the full 4D length which is rarely the intended spatial length.
  • Involves a square root — avoid calling in tight loops where Vector4_SizeSquared suffices (e.g., comparing magnitudes: compare squared values instead).

Signature

static UE_INL_API double Vector4_Size(const FVector4& A)

Parameters

Name Type Description Default
A const FVector4& The vector whose magnitude is calculated.

Return Type

double

Example

Check whether a 4D vector is unit-length C++
FVector4 Q(0.0, 0.0, 0.7071, 0.7071); // quaternion-like
double Len = UKismetMathLibrary::Vector4_Size(Q);
bool bIsUnit = FMath::IsNearlyEqual(Len, 1.0, 1e-4);

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.