Sprinting get interrupted after crouch

Hi there,

I have a simple crouching and sprinting system, but I have an annoying bug that makes it very janky.
For example: When I am sprinting, I crouch, while still holding sprint (crouching speed isn’t affected) and then releasing crouch, it starts walking, but I want to, if still holding sprint, start sprinting uninterruptedly again after releasing crouch. This would make quickly accelerating frustrating for players.
How can I fix this?
Thanks.

Hey there @M1l0! So if you’re using the built in crouch function on the character movement component, (depending entirely on how you have your sprint set up, for the sake of this answer we’re going to assume you have a sprint event or function), you could just keep a bool for when sprint is held, then if it’s active when you crouch defer to the crouch speed, and if it’s still held when you fire your uncrouch event, just begin the sprint function again. Many systems that do a “slide to crouch” work this way.

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

A tutorial that does this (somewhat long I apologize, you could ignore the sliding as well if you want, but the transaction between them is what is relevant):

You can try using a node called “Is Input Key Down,” which checks if you are holding down an input. It will check to see if your holding down an input, which in this case would be your sprint input. If you are holding down your input AND not crouching then you want to go into sprint.

(I recommended doing this check right after you press the “un-crouch” input so there is no delay)

Thanks. I’ll try these.