APawn::GetPendingMovementInputVector
#include "GameFramework/Pawn.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallableconst
Description
Returns the accumulated movement input vector that has not yet been consumed by a movement update. This reflects the current frame's accumulated calls to AddMovementInput.
Caveats & Gotchas
- • This value is zeroed out by ConsumeMovementInputVector(), which is called by PawnMovementComponent during its update. Reading it after the movement component ticks will return zero for that frame.
- • The vector is not normalized — multiple calls to AddMovementInput in one frame accumulate. Check magnitude before using as a direction to avoid division-by-zero.
Signature
FVector GetPendingMovementInputVector() const; Return Type
FVector Example
Read pending input in a custom movement tick C++
void AMyPawn::TickMovement(float DeltaTime)
{
FVector Input = GetPendingMovementInputVector();
if (!Input.IsNearlyZero())
{
Input = Input.GetSafeNormal();
SetActorLocation(GetActorLocation() + Input * MoveSpeed * DeltaTime);
ConsumeMovementInputVector(); // Clear after consuming
}
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?