RealDocs

UKismetMathLibrary::CreateVectorFromYawPitch

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

Description

Converts Yaw and Pitch angles in degrees into a directional vector, optionally scaled to a given length. Roll is ignored — the output has no roll component.

Caveats & Gotchas

  • Parameters are float, not double, unlike most UE5 math functions that were upgraded. Implicit conversion from double variables will compile but may produce precision-loss warnings.
  • This function is effectively FRotator(Pitch, Yaw, 0).Vector() * Length. If you already have an FRotator, calling its Vector() method directly is cheaper and avoids the redundant conversion.
  • Positive Pitch tilts upward in Unreal (+Z). Some external math references define pitch sign opposite (nose-down positive). Verify the sign convention when translating formulas.

Signature

static ENGINE_API FVector CreateVectorFromYawPitch(float Yaw, float Pitch, float Length = 1.0f);

Parameters

Name Type Description Default
Yaw float Horizontal rotation in degrees, measured around the Z axis.
Pitch float Vertical rotation in degrees; positive tilts the vector upward.
Length float Magnitude of the resulting vector. 1.0f

Return Type

FVector

Example

Fire a projectile at a specific yaw and pitch C++
float Yaw = Controller->GetControlRotation().Yaw;
float Pitch = 15.0f; // 15-degree upward arc
FVector LaunchDir = UKismetMathLibrary::CreateVectorFromYawPitch(Yaw, Pitch, 1.0f);
Projectile->FireInDirection(LaunchDir);

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.