RealDocs

APawn::AddControllerYawInput

function Engine Blueprint Since 4.0
#include "GameFramework/Pawn.h"
Access: public Specifiers: virtualUFUNCTIONBlueprintCallable

Description

Adds yaw rotation to the owning PlayerController's ControlRotation, used to turn the camera or pawn left and right. Only affects local PlayerControllers.

Caveats & Gotchas

  • The effective rotation change is Val * InputYawScale. InputYawScale defaults to 1.0, but players can change it via sensitivity settings. Do not pre-scale Val with a sensitivity multiplier or it will stack.
  • If bUseControllerRotationYaw is false on the pawn, the pawn's actor rotation will not follow the controller rotation change — the camera will turn but the mesh will not.

Signature

virtual void AddControllerYawInput(float Val);

Parameters

Name Type Description Default
Val float Amount to add to yaw. Multiplied by the PlayerController's InputYawScale before application.

Return Type

void

Examples

Scale mouse axis input and apply yaw rotation to the pawn Blueprint
InputAxis LookRight Axis Value Add Controller Yaw Input Target is Pawn Target Val float × float 1.5 Return Value Return Value
Edit Blueprint graph Scale mouse axis input and apply yaw rotation to the pawn
Drag node headers to move · Drag from an output pin to an input pin to connect · Scroll to zoom · Right-click for actions
Bind mouse X axis to turn C++
void AMyPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);
	PlayerInputComponent->BindAxis("Turn", this, &AMyPawn::AddControllerYawInput);
}

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.