RealDocs

UKismetMathLibrary::GetYawPitchFromVector

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

Description

Decomposes a direction vector into Yaw and Pitch rotation values in degrees. Roll is always zero since a direction vector has no roll component.

Caveats & Gotchas

  • The output angles are non-clamped — they can exceed the usual [-180, 180] range for Yaw when the input vector is derived from accumulated transforms.
  • The function does not normalize the input vector first. Passing a non-unit vector still works (uses atan2 internally), but the resulting angles match the direction of the vector regardless of its length.

Signature

static ENGINE_API void GetYawPitchFromVector(FVector InVec, float& Yaw, float& Pitch);

Parameters

Name Type Description Default
InVec FVector The direction vector to decompose.
Yaw float& Output yaw angle in degrees.
Pitch float& Output pitch angle in degrees.

Return Type

void

Example

Get camera yaw/pitch from look direction C++
FVector LookDir = CameraComponent->GetForwardVector();
float Yaw, Pitch;
UKismetMathLibrary::GetYawPitchFromVector(LookDir, Yaw, Pitch);
UE_LOG(LogTemp, Log, TEXT("Yaw=%.1f Pitch=%.1f"), Yaw, Pitch);

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.