APawn::AddControllerYawInput
#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
Bind mouse X axis to turn C++
void AMyPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis("Turn", this, &AMyPawn::AddControllerYawInput);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?