APawn::GetControlRotation
#include "GameFramework/Pawn.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Returns the rotation of this pawn's controller, which typically represents the player's look direction or the AI's facing direction. Returns FRotator::ZeroRotator if the pawn has no controller.
Caveats & Gotchas
- • For player characters, this is the camera/crosshair rotation — it often differs significantly from GetActorRotation(), especially in third-person games where the pawn body and the camera can face different directions.
- • Returns FRotator::ZeroRotator (not the pawn's actual rotation) when there is no controller, which can cause subtle aim bugs in offline or AI-controlled pawns that are temporarily unpossessed.
- • In multiplayer, the control rotation for remote players is reconstructed from the compressed RemoteViewPitch16 byte — pitch precision is limited to approximately 0.005 degrees steps.
Signature
FRotator GetControlRotation() const Return Type
FRotator Examples
Orient pawn to face controller look direction (yaw only) on BeginPlay
Blueprint
Fire projectile along look direction C++
void AMyPawn::Fire()
{
FRotator MuzzleRotation = GetControlRotation();
FVector MuzzleLocation = GetMesh()->GetSocketLocation(TEXT("Muzzle"));
FActorSpawnParameters Params;
Params.Instigator = this;
GetWorld()->SpawnActor<AMyProjectile>(MuzzleLocation, MuzzleRotation, Params);
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?