RealDocs

FVector

struct Core Blueprint Since 1.0
#include "Math/Vector.h"
Access: public Specifiers: USTRUCT

Description

A 3D vector with double-precision (UE 5.0+) X, Y, Z components. Used ubiquitously for positions, directions, velocities, and scales throughout the engine. FVector is a value type — it can be stored on the stack and passed by value.

Signature

struct FVector

Caveats & Gotchas

  • As of UE 5.0, FVector uses double precision (FVector = TVector<double>). Use FVector3f (float) explicitly if you need single-precision for performance-sensitive GPU data.
  • FVector does NOT represent a direction unless explicitly normalized. Call `GetSafeNormal()` before using as a direction.
  • FVector::ZeroVector is a global constant for (0, 0, 0). Prefer it over constructing a zero vector manually.
  • Equality comparison with == is exact floating-point — use `Equals(Other, Tolerance)` for approximate checks.

Example

Common FVector operations C++
FVector A(100.f, 0.f, 0.f);
FVector B(0.f, 100.f, 0.f);

// Distance
float Dist = FVector::Dist(A, B);  // 141.4...

// Direction from A to B
FVector Dir = (B - A).GetSafeNormal();

// Dot and cross products
float Dot = FVector::DotProduct(A, B);   // 0
FVector Cross = FVector::CrossProduct(A, B); // (0, 0, 10000)

// Lerp
FVector Mid = FMath::Lerp(A, B, 0.5f);  // (50, 50, 0)

Functions (7)

Utility
1
Access Type Name
public function FVector::GetSafeNormal
Math
6
Access Type Name
public function FVector::CrossProduct
public function FVector::Distance
public function FVector::DotProduct
public function FVector::IsNearlyZero
public function FVector::IsZero
public function FVector::RotateAngleAxis

Version History

Introduced in: 1.0

Version Status Notes
5.6 stable
5.0 stable Changed from float to double precision (TVector<double>).
4.27 stable Single-precision float.

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.