UKismetMathLibrary::DegAtan2
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPureUFUNCTION
Description
Returns the four-quadrant inverse tangent (atan2) of Y/X in degrees. Gives the signed angle from the positive X-axis to the point (X, Y).
Caveats & Gotchas
- • When both X and Y are zero the result is 0 degrees — there is no error or undefined-behavior guard, so callers must handle the degenerate case if it can arise.
- • Parameter order is (Y, X), matching the C standard atan2 convention but opposite to how coordinates are often written — double-check argument order when porting formulas.
Signature
static UE_INL_API double DegAtan2(double Y, double X); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Y | double | The Y component (numerator). | — |
| X | double | The X component (denominator). | — |
Return Type
double Example
2D direction angle from a vector C++
FVector2D Dir = FVector2D(1.0f, 1.0f).GetSafeNormal();
double AngleDeg = UKismetMathLibrary::DegAtan2(Dir.Y, Dir.X); // ~45.0 Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?