RealDocs

APawn::AddControllerPitchInput

function Engine Blueprint Since 4.0
#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
InputAxis LookUp Axis Value Look Sensitivity Look Sensitivity Look Sensitivity Multiply (Float) A B Return Value Return Value Add Controller Pitch Input Target is Pawn Target Val
Edit Blueprint graph Scale look-up axis input and apply as controller pitch
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 Y axis to look up/down C++
void AMyPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);
	PlayerInputComponent->BindAxis("LookUp", this, &AMyPawn::AddControllerPitchInput);
}

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.