RealDocs

UKismetMathLibrary::DegCos

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

Description

Returns the cosine of A where A is in degrees. Equivalent to Cos(DegreesToRadians(A)) but avoids the manual conversion step.

Caveats & Gotchas

  • Prefer this over Cos when your angle is stored in degrees (e.g. from a UPROPERTY or designer variable) — it removes the conversion step that is easy to forget.
  • In Blueprint the compact node title is 'COSd'; the plain 'COS' node expects radians and is easily confused with this one.

Signature

static UE_INL_API double DegCos(double A);

Parameters

Name Type Description Default
A double Angle in degrees.

Return Type

double

Example

Compute forward component from yaw angle C++
double YawDeg = GetActorRotation().Yaw;
double ForwardX = UKismetMathLibrary::DegCos(YawDeg);
double ForwardY = UKismetMathLibrary::DegSin(YawDeg);

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.