APawn::AddMovementInput
#include "GameFramework/Pawn.h"
Access: public
Specifiers: virtualUFUNCTIONBlueprintCallable
Description
Accumulates a world-space movement direction into the pawn's input vector. For base APawn, movement is not applied automatically — the pawn or its movement component must call ConsumeMovementInputVector() in Tick. Subclasses like ACharacter handle this automatically.
Caveats & Gotchas
- • On base APawn (not ACharacter), calling this does nothing visible unless you manually read and apply the input vector in your Tick or movement component. The input accumulates in ControlInputVector but no movement occurs automatically.
- • Input is ignored by default if the controller has bIgnoreMoveInput set. Use bForce=true only when you intentionally want to bypass this, such as for scripted movement that should not be blockable by game logic.
Signature
virtual void AddMovementInput(FVector WorldDirection, float ScaleValue = 1.0f, bool bForce = false); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| WorldDirection | FVector | Direction in world space to apply input. Usually normalized. | — |
| ScaleValue | float | Scale applied to the direction vector. Negative values reverse direction. Analog input uses values between -1 and 1. | 1.0f |
| bForce | bool | If true, add input even when IsMoveInputIgnored() returns true. | false |
Return Type
void Examples
Drive the pawn forward every tick along its facing direction
Blueprint
Move forward based on controller rotation C++
void AMyPawn::MoveForward(float Value)
{
if (Controller && Value != 0.0f)
{
const FRotator Rotation = Controller->GetControlRotation();
const FRotator YawRotation(0, Rotation.Yaw, 0);
const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
AddMovementInput(Direction, Value);
}
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?