UKismetMathLibrary::Acos
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the inverse cosine (arc cosine) of A in radians. The result is in the range [0, π].
Caveats & Gotchas
- • Input must be clamped to [-1, 1]; passing a value outside this range returns NaN, which silently corrupts downstream calculations.
- • The result is in radians — convert with RadiansToDegrees if you need degrees, and be aware that floating-point dot-product values may slightly exceed 1.0 due to precision errors, requiring a manual clamp before calling.
Signature
static UE_INL_API double Acos(double A); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | double | Value in the range [-1, 1] to compute the arc cosine of. | — |
Return Type
double Example
Angle between two unit vectors C++
FVector A = FVector(1, 0, 0);
FVector B = FVector(0, 1, 0);
double Dot = FVector::DotProduct(A, B);
double AngleRad = UKismetMathLibrary::Acos(FMath::Clamp(Dot, -1.0, 1.0));
double AngleDeg = UKismetMathLibrary::RadiansToDegrees(AngleRad); // 90.0 Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?