Hello everyone,
I’ve been putting together a tank control system (ala Resident Evil), but I’m having an issue with sprinting.
As with Resident Evil, the player is only supposed to be able to sprint when moving forward. If they go backwards, the sprint should be cancelled and the movement speed should revert back to the initial walking speed.
Here’s the problem: whenever I continue to hold my Sprint button (Left Shift in this case) and go from moving forwards to moving backwards, the character reverses direction (as it should) but maintains the sprinting speed (as it should not).
Anyone have any ideas?
Yup
You also need to reduce the speed when they start travelling backwards. IE, also put a reduce speed node in the upper part of your graph where the booleans are getting set.
What about that? My “Jump” would be your sprintKey of course. You can Exchange the Float > 0 with a >= 0 to allow the Character to sprint from standing
Got it! Thanks for your help. It even put me in the right state-of-mind to fix the follow-up issue.
Just in case someone runs into the same issue:
I immediately had the reverse problem where walking backwards while holding Sprint would reduce the speed. I fixed this by creating an isRunning bool and toggled it based on whether Sprint was pressed or not.
See below: