{ }Blueprint → C++

Unreal Engine 5 · Blueprint → C++

Get Control Rotation in Unreal Engine 5 C++UE Docs

The Get Control Rotation Blueprint node maps to APawn::GetControlRotation() in Unreal Engine 5 C++, often combined with FRotationMatrix to derive a yaw-only forward direction for movement.

Blueprint node & C++ equivalent

C++
FRotator ControlRot = GetControlRotation();
// Yaw-only forward (common for movement):
FRotator YawRot(0.f, ControlRot.Yaw, 0.f);
FVector Forward = FRotationMatrix(YawRot).GetUnitAxis(EAxis::X);

What does the Get Control Rotation node do?

Get Control Rotation returns the rotation the controller is aiming at as an FRotator, including yaw, pitch and roll. For movement you usually want only the yaw so the character moves along the ground regardless of where the camera looks vertically.

The example zeroes pitch and roll into YawRot, then uses FRotationMatrix(YawRot).GetUnitAxis(EAxis::X) to get the forward vector on the horizontal plane.

How to use it in C++

Call GetControlRotation() on the pawn to read the control orientation. To build a movement basis, construct an FRotator(0.f, ControlRot.Yaw, 0.f), convert it with FRotationMatrix, and pull GetUnitAxis(EAxis::X) for forward or EAxis::Y for right. Feed those vectors into AddMovementInput for camera-relative movement.

This yaw-only pattern is the standard way to make WASD movement follow the camera direction without tilting the character up or down.

Frequently asked questions

How do you get the camera forward direction in UE5 C++?+

Read GetControlRotation(), keep only the yaw in an FRotator, then call FRotationMatrix(YawRot).GetUnitAxis(EAxis::X) to get the forward vector.

Why use yaw-only control rotation for movement?+

Zeroing pitch and roll keeps the character moving along the ground even when the camera looks up or down, which is the expected behavior for most third-person movement.

Related Character & Pawn nodes

View all Character & Pawn nodes →