Issue with my sprinting

Hi there,

I am using the new EnhancedInputSystem and have a sprinting and stamina system.

When jumping, crouching or out of stamina, the sprinting is interrupted even while holding the shift key (which is what I want). However when the before mentioned criteria, for example holding shift while jumping and landing, is over and the sprint key is still held, it doesn’t start sprinting unless it’s released and pressed again.

This feels very janky. Any ideas on a fix?
Also, with the new input system, how can I add a menu to let users bind the keys themselves?

Thanks!

Hi M1I0,

Check in your Input Mappings - you can set the Trigger type to various behaviors - the default is Pressed…

(Check the “Is Player Mappable” too)

Hi,
I’ve set it to Hold and now when in the air it continues to drain (which I fixed before) and once I land I keep on sprinting, but the stamina no longer drains. I just realised I can use a set timer by event so it continuously runs the Start Sprinting to check whether it can sprint and it worked. However, is this a good idea?

It depends on if you’re wanting other things in there too I guess…

You can set two triggers - one for “Down” and one for “Released” and control that part yourself without needing timers.

I’ve built a system like Far Cry where your sprint speed decreases over time depending on fitness, and the speed changes for slope and water depth - I ended up putting some of that into my characters tick - if you can keep the code small it shouldn’t impact things…

Thanks, I’ll try this.

Regarding the player mappable, what does the metadata input mean?

That’s a generic Metadata reference that ties with the custom input - you can use that to specify things like Icons or ability system assets etc - it can be left empty.

Alright.