While working on character movement, we may want access to the direction the player last provided as input. Unreal exposes this through the Get Last Movement Input Vector node.
This node returns the most recent movement input direction applied to the pawn. In simple terms, it tells us which direction the player last tried to move in. As shown in the screenshot below, the output is a vector representing that last input direction.
One practical use for this is implementing directional abilities such as a dash. Instead of checking where the character is at that moment, we can use the last movement input to decide the dash direction, which makes the ability respond naturally to what the player was pressing just before activating it.
One thing to keep in mind is that this value is input dependent. As soon as the pawn stops receiving movement input, Get Last Movement Input Vector will return a zero vector. Because of this, it’s best used at the moment an action is triggered rather than stored or checked later.
As long as we keep that behavior in mind, it works well for abilities or actions that need to respond to the player’s last movement input.


Comments
Post a Comment