UKismetMathLibrary::DegAcos
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the inverse cosine (arc cosine) of A in degrees. The result is in the range [0°, 180°]. Use when you need the angle between two vectors expressed in degrees.
Caveats & Gotchas
- • Input must be clamped to [-1, 1] before calling — dot products of non-perfectly-normalised vectors can marginally exceed this range and produce NaN that silently propagates through subsequent math.
- • The output range [0°, 180°] means you cannot distinguish left-of vs right-of from the result alone; if you need a signed angle use DegAtan2.
Signature
static UE_INL_API double DegAcos(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 in degrees C++
FVector A = GetActorForwardVector();
FVector B = (Target->GetActorLocation() - GetActorLocation()).GetSafeNormal();
double AngleDeg = UKismetMathLibrary::DegAcos(FMath::Clamp(FVector::DotProduct(A, B), -1.0, 1.0)); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?