RealDocs

FMath::DegreesToRadians

function Core Since 4.0
#include "Math/UnrealMathUtility.h"
Access: public Specifiers: staticconstexpr

Description

Converts an angle from degrees to radians by multiplying by π/180. The most commonly used angle conversion in UE — required before passing degree values to sin/cos/atan.

Caveats & Gotchas

  • UE's FRotator stores angles in degrees, so always convert via this function before feeding rotator components into trigonometric functions. Forgetting the conversion is a very common source of incorrect rotation logic.
  • Like RadiansToDegrees, the generic template uses single-precision UE_PI. For double-precision work, rely on the explicit double overload to get UE_DOUBLE_PI.

Signature

template<class T>
[[nodiscard]] static constexpr UE_FORCEINLINE_HINT auto DegreesToRadians(T const& DegVal) -> decltype(DegVal * (UE_PI / 180.f))

Parameters

Name Type Description Default
DegVal T const& Angle value in degrees to convert.

Return Type

auto (T)

Example

Convert a yaw angle before computing direction vector C++
float YawDeg = MyController->GetControlRotation().Yaw;
float YawRad = FMath::DegreesToRadians(YawDeg);
FVector ForwardDir(FMath::Cos(YawRad), FMath::Sin(YawRad), 0.f);

Tags

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.