Disable Strafing and Backwards sprinting?

Hey all, I’m pretty new to UE4 after moving from Unity. I’m currently developing a horror game and do not want sprinting backwards or strafing. Here is the code I have for my movement, along with sprinting. How can I disable sprinting if the player presses S, A, or D, while sprinting? Many thanks.

1 Like

Just remove the InputAxis LeftRight and make sure the Scale parameter value from Forward & Back is always greater than zero.

In case someone is looking for a C++ alternative, you can add FVector ConstrainInputAcceleration(const FVector& InputAcceleration) const override; to your CharacterMovementComponent subclass and implement it accordingly. Unfortunately that function cannot be overridden in Blueprint.