FMath::RadiansToDegrees
#include "Math/UnrealMathUtility.h"
Access: public
Specifiers: staticconstexpr
Description
Converts an angle from radians to degrees by multiplying by 180/π. Works with float, double, or any arithmetic type.
Caveats & Gotchas
- • Uses the float constant UE_PI (single precision) in the generic template, so passing a double may lose precision. Use the explicit double overload (RadiansToDegrees(double)) for full double precision.
- • The [[nodiscard]] attribute means the compiler will warn if you call this without using the return value — a common mistake when converting in-place.
Signature
template<class T>
[[nodiscard]] static constexpr UE_FORCEINLINE_HINT auto RadiansToDegrees(T const& RadVal) -> decltype(RadVal * (180.f / UE_PI)) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| RadVal | T const& | Angle value in radians to convert. | — |
Return Type
auto (T) Example
Convert a computed radian angle to degrees for display C++
float AngleRad = FMath::Atan2(Direction.Y, Direction.X);
float AngleDeg = FMath::RadiansToDegrees(AngleRad);
UE_LOG(LogGame, Log, TEXT("Angle: %.2f degrees"), AngleDeg); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?