APawn::Internal_ConsumeMovementInputVector
#include "GameFramework/Pawn.h"
Access: public
Description
Copies ControlInputVector to LastControlInputVector, then returns and zeroes out ControlInputVector. This is the internal version of ConsumeMovementInputVector, intended for PawnMovementComponent implementations.
Caveats & Gotchas
- • After this call, Internal_GetPendingMovementInputVector() returns FVector::ZeroVector for the rest of the frame. If multiple movement components or code paths call this in one tick, only the first caller gets the non-zero value.
- • The public ConsumeMovementInputVector() is a virtual UFUNCTION that ultimately calls this. If you are writing a movement component subclass, prefer calling this directly to avoid re-entering the virtual chain.
- • This does not communicate to the PlayerController that input was consumed. The PlayerController accumulates input independently; this only clears the pawn-side mirror of that input.
Signature
ENGINE_API FVector Internal_ConsumeMovementInputVector(); Return Type
FVector Example
Consume and apply input in a custom movement component tick C++
void UMyMovementComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
if (!PawnOwner || !UpdatedComponent) { return; }
// Consume input — zeroes ControlInputVector, stores it in LastControlInputVector
FVector InputVector = PawnOwner->Internal_ConsumeMovementInputVector();
if (InputVector.IsNearlyZero()) { return; }
FVector Delta = InputVector.GetSafeNormal() * MaxSpeed * DeltaTime;
FHitResult Hit;
SafeMovePawnAlongVector(Delta, UpdatedComponent->GetComponentQuat(), true, Hit);
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?