Slowing a character's falling speed

I was wondering if anyone could help me out with trying to make a game mechanic where if the player character presses & holds down the jump button while in mid-air, the player character’s falling speed will be significantly reduced as long as they’re holding down the button, similar to Cape Mario from Super Mario World or Dixie Kong from Donkey Kong Country 2 & 3.

nes-super-mario

7d2df0572141f0a79b59d0b9649b6ef5f2a3b8d5r1-240-209_hq

I’ve made my own setup but its not working for some reason.

One thing I’ve noticed is that when I put in a print string right after the input and before the rest of the code, I’m not getting a message when I press the jump button in mid-air. would seem to imply that whatever the issue is, it starts with the button input.

Since the input button for slowing the player’s descent is also used in the Player Controller blueprint for jumping, I’m guessing the problem is that I can’t use the same input button twice in two different blueprints.

Making things more complicated is that the game I’m making has multiple different playable characters each with different abilities & the slow descent mechanic is only used by one specific character, while another is planned to have an air dash that is also triggered by pressing the jump button while in mid-air. is the reason why the coding for the slow descent mechanic isn’t simply located within the jump mechanics section of the Play Controller blueprint.

Does anyone have any idea on how I can tie multiple different character abilities to a single button? Any whatsoever would be greatly appreciated!

Hey there @HungryMoogle! I’m assuming you’re using all the same character for all player types Castlevania style. If that’s right, one way to make every character handle the effects differently would be to check which they are at the time. Here I used an Enum with different player types to determine what to do after the original jump input. is where you can set your slowfall or bubble, and even handle how you’d pass it into the dash or other types of movement with the jump input (assuming they can all jump normally, if not you’d just shift the enum selector before the jump / stop jumping.) Aside from that, your inputs definitely could be overlapping if you’re trying to use multiple of the same IA.

As for slowing the speed, your gravity based way works fine! Another less efficient method I’ve seen is clamping the player’s -Z velocity. is almost never needed unless you can be “launched” by things.

I found the solution in another topic [Link] and I’ve managed to get the slowed descent to work. Turns out that I simply needed to disable Consume Input option on the button input to make it work.

However after testing the slowed falling ability I’ve encountered a couple of problems with the blueprint that need to be addressed.

Firstly, when the ability is activated instead of the character’s jumping coming to a immediate halt before transitioning into a slowed descent, the character tends to continue in a slowed upward trajectory for a bit. When character does begin their descent, I find their movement to be a bit wonky due to acceleration from falling.

In the games that I mentioned, the player character immediately transitions into a slowed fall as soon as the jump button is pressed in mid-air and their descent occurs at a consistent speed, so I don’t think Gravity Scale is going to work for my purposes. Is there an alternative way that I can halt the player’s upward trajectory during a jump and reduce the character’s falling speed to a consistent rate?

The other major problem I’m having comes when the player character lands on any actor. What’s supposed to happen is that the slow falling event is supposed to be cancelled when the player lands on another actor such as an enemy and the player character bounces off them like normal. Instead, when the player character lands on the actor, the player is catapulted into the air as a result of the continuing reduced gravity.

I tried to use the interface I use for jump collisions to attempt to call off the slowed descent event but it hasn’t worked.

Any ideas on what I can do about either of these problems?

Alright so to be clear, as soon as the jump button is released you’d like it to immediately stop ascending and start gliding like right?

UnrealEditor_2022-10-23_09-59-25

UnrealEditor_2022-10-23_10-27-39

So here’s a bit of an overengineered way to do with a touch of hack.

So the reason it’s a bit odd is that the standard character BP actually does have settings for stopping the jump on release (that’s what stop jumping is for) but for some reason I couldn’t have it apply instantly, so I forced it in the velocity. Which means I had to stop the velocity dead, which could cause adverse effects in some rare cases.

Remember to zoom out on the BP as well. Let me know if works!

1 Like

Sorry for the belated response but I tried implementing your solution into my setup in the way that I think you intended, although I can’t say for certain.

Things have improved a bit but there’s a major glitch that needs to be addressed. For some reason if I have the player character activate the gliding ability mid-jump while they’re still moving upwards the player character will continually float upwards until the gliding button is released. The same thing also happens if the player character bounces off the head of an enemy while gliding.

So it looks like your velocity clamp is only occurring once when first pressed. The gravity removal shouldn’t be necessary if you clamp the fall speed and there needs to be a landed even so you can remove the glide. Could I see where you implemented the jump, stop jumping, and landed portions as well?

1 Like

I already have an event for ending the glide event.

Are you talking about the general jumping logic?

Something to keep in mind is that the game I’m making features multiple player characters each with different abilities. As such, the gliding ability I’m trying to implement is supposed to be limited to one specific character while other characters have entirely different abilities tied to jumping. So I’d rather not apply the gliding ability logic directly to the jump logic as its going to make things extremely complicated trying to limit that ability to one character while simultaneously trying to incorporate other abilities all into the same place. For simplicities sake, I’m trying to keep the characters’ unique abilities within their own blueprints while abilities that shared across every character like walking/running, jumping & crouching are either in the player controller blueprint or the master blueprint that every character is parented to.

No problem! I think the difference we have in our setup is that mine is integrated (assuming it’s just a child) from my original understanding that you wanted the glide/bubble to occur every time you jump instead of after a specific input. will change things a bit.

As for your inheritance you can just have proxy extensions for each child, just making sure the logic flows how you want it is the only part I think might be the blockage.

So just to clear up the design before I send alterations for you.

Do you want the player to always bubble after jumps or only upon a different input? (looks like a different input from what you showed but I have to clarify for sure).

Is landing and releasing the button the only methods you want to stop the bubble?

1 Like

Sorry for the belated response.

Uh, I don’t know what an proxy extension is.

Probably a different input, I guess?

No, the bubble should also pop if the player sustains damage from the enemy and maybe when the player lands on an enemy’s head, I’m not sure. I’m pretty sure in Super Mario World if the player is holding the jump button while slowly descending as Cape Mario, his slowed movement will continue until the button is released or he touches the ground. In the Donkey Kong Country games on the other hand, Dixie Kong’s slow descent will be cancelled if she lands on the head of an enemy. I haven’t really decided to what approach I should take on particular matter. At the very least, the bubble should definitely pop when the player takes damage.

Alright! So here’s a bit of an update, you could swap the input for a different one if you prefer. You could also do as a child class of your original character BP depending on how you do the character changes. It currently works a bit like Tanuki suit, but you’ll still have to handle sending over the damage events, the goomba stomp, etc. But the popping mechanism is intact and functioning. I even did a bit of visuals to show you when the glide is happening.

UnrealEditor_2022-11-17_20-21-46

seem a bit more like your use case?

1 Like

Sorry for the belated response but after over a year of getting distracted working on other parts of my project, I have finally got around to trying out your solution. Your proposed solution is almost perfect and works better than what I’ve been trying recently except for two issues; one minor and one major.

The minor issue is that the bubble that encases the player character doesn’t appear while gliding like its supposed to and instead appears when the player character lands up on the ground. So basically, the whole thing is backwards and I’m not sure what I did wrong or how to fix it.

The major issue on the other hand, is that the player character has lost the ability to damage enemies by jumping on them, instead resulting in the player character taking damage. The other four playable characters are unaffected by this problem, only affecting the one with the Bubble Float ability. I’m not sure why this is happening but my best guess is that its related to the use of Event Tick since my jumping collision code uses Event Tick as does this blueprint for the Fall Speed Clamp. Perhaps the Tick Proxy event tick is overriding the Jump Collision event tick?

Jump Collision blueprint:

Fall Speed Clamp:

Jump Input:

Bubble Code:

Thank you for your efforts so far!

Okay, I finally got it working.

I combined SupportiveEntity’s solution with my previous setup based on the one from this video to get my desired setup.

I also managed to fix the Event Tick issue by using a Interface blueprint instead to communicate to the Character Master Class blueprint rather than directly having the Event Tick on the character blueprint with the float ability. This prevents having one Event Tick override another which I’m pretty sure what was causing the problem.

Thanks for all the help!

1 Like