RealDocs

UKismetMathLibrary::Vector_HeadingAngle

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

Description

Converts a direction vector into a 'heading' angle in radians within the range +/-PI. Zero degrees (0 radians) points down the +X axis. Useful for computing compass-style headings from world-space direction vectors.

Caveats & Gotchas

  • The result is in radians, not degrees. Multiply by (180.0 / PI) or use FMath::RadiansToDegrees() if you need degrees.
  • Only the XY plane is considered — the Z component of the input vector is ignored. For a full 3D spherical angle, use a different approach.
  • A zero-length XY component (vector pointing straight up or down) will return 0 radians due to atan2(0,0) behaviour.

Signature

static UE_INL_API double Vector_HeadingAngle(FVector A);

Parameters

Name Type Description Default
A FVector Direction vector to convert to a heading angle.

Return Type

double

Example

Compute compass heading of an actor's forward vector C++
FVector Forward = GetActorForwardVector();
double HeadingRad = UKismetMathLibrary::Vector_HeadingAngle(Forward);
double HeadingDeg = FMath::RadiansToDegrees(HeadingRad);
// HeadingDeg: 0 = North (+X), 90 = West (+Y in UE's left-hand system)

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.