RealDocs

UKismetMathLibrary::Cos

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

Description

Returns the cosine of the given angle in radians. Use DegCos instead if your angle is already in degrees.

Caveats & Gotchas

  • Input must be in radians — a common mistake is passing degrees directly, which produces wrong results. Convert with DegreesToRadians first if needed.
  • Returns a double; if you assign to a float variable the compiler will silently narrow the precision, which can cause subtle drift in tight simulation loops.

Signature

static UE_INL_API double Cos(double A);

Parameters

Name Type Description Default
A double Angle in radians.

Return Type

double

Example

Compute horizontal component of a direction C++
float AngleRad = FMath::DegreesToRadians(45.f);
double CosVal = UKismetMathLibrary::Cos(AngleRad);
// CosVal ≈ 0.7071

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.