APawn::AddControllerPitchInput
#include "GameFramework/Pawn.h"
Access: public
Specifiers: virtualUFUNCTIONBlueprintCallable
Description
Adds pitch rotation to the owning PlayerController's ControlRotation. Only works when possessed by a local PlayerController — has no effect on AI-controlled pawns.
Caveats & Gotchas
- • The value is scaled by PlayerController::InputPitchScale (default -1.0), which inverts pitch by default so that moving the mouse up tilts the camera up. Passing 1.0f will pitch down in default settings.
- • This function does nothing if the controller is not a local PlayerController. AI controllers and remote player controllers both result in a no-op, so it is safe to call unconditionally.
Signature
virtual void AddControllerPitchInput(float Val); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Val | float | Amount to add to pitch. Multiplied by the PlayerController's InputPitchScale before application. | — |
Return Type
void Examples
Scale look-up axis input and apply as controller pitch
Blueprint
Bind mouse Y axis to look up/down C++
void AMyPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis("LookUp", this, &AMyPawn::AddControllerPitchInput);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?