RealDocs

APawn::Internal_GetLastMovementInputVector

function Engine Since 4.0
#include "GameFramework/Pawn.h"
Access: public Specifiers: inline

Description

Returns the LastControlInputVector — the input value that was active at the point of the last ConsumeMovementInputVector call. Intended for PawnMovementComponent internals that need the previously processed input.

Caveats & Gotchas

  • This returns the input from the previous consume cycle, not the current frame's accumulated input. If you need what has been collected this frame but not yet consumed, use Internal_GetPendingMovementInputVector() instead.
  • The public equivalent GetLastMovementInputVector() is a UFUNCTION and is the correct choice for game-layer code such as animation blueprints. This internal version is intended for movement component implementations.
  • The value persists until the next consume call. In frames where no input is applied and no consume happens (e.g. the pawn is unpossessed), this will still hold the last non-zero input from whenever input was last consumed.

Signature

inline FVector Internal_GetLastMovementInputVector() const { return LastControlInputVector; }

Return Type

FVector

Example

Use last input direction in an animation update from a movement component C++
// After consuming input this tick:
FVector LastInput = PawnOwner->Internal_GetLastMovementInputVector();
if (UMyAnimInstance* Anim = Cast<UMyAnimInstance>(GetCharacterOwner()->GetMesh()->GetAnimInstance()))
{
	Anim->SetMovementInputDirection(LastInput.GetSafeNormal());
}

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.