UKismetMathLibrary::GetAzimuthAndElevation
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Decomposes a world-space direction vector into Azimuth and Elevation angles expressed relative to a given reference frame. Useful for targeting systems where angles are needed in a turret's or character's local space.
Caveats & Gotchas
- • Unlike GetYawPitchFromVector, this function requires an explicit reference frame — pass the actor's world transform when you need angles relative to the actor's facing direction rather than world axes.
- • The output angles are non-clamped, matching the behaviour of GetYawPitchFromVector. Do not assume Azimuth is always in [-180, 180] without clamping it yourself.
Signature
static ENGINE_API void GetAzimuthAndElevation(FVector InDirection, const FTransform& ReferenceFrame, float& Azimuth, float& Elevation); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InDirection | FVector | World-space direction vector to convert. | — |
| ReferenceFrame | const FTransform& | The transform that defines the local frame (e.g. an actor's world transform). | — |
| Azimuth | float& | Output azimuth (yaw) angle in degrees relative to the reference frame. | — |
| Elevation | float& | Output elevation (pitch) angle in degrees relative to the reference frame. | — |
Return Type
void Example
Compute turret aim angles relative to vehicle orientation C++
FVector TargetDir = UKismetMathLibrary::GetDirectionUnitVector(
TurretBase->GetComponentLocation(),
TargetLocation);
float Azimuth, Elevation;
UKismetMathLibrary::GetAzimuthAndElevation(
TargetDir,
TurretBase->GetComponentTransform(),
Azimuth,
Elevation);
// Azimuth/Elevation are now in turret-local degrees See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?