What mapping should I use for the Jump button and Double-Jump?

I’m sorry for this noob question. I’m really having a hard time deciding the type of mapping for each of the actions of my future game and I’d like the opinion of more experienced developers to help me understand what I need to do for my need (as I’m working on this project alone).

The behaviour of the Jump button should be that if you hold it down, the character jumps higher, and a quick press will make a short jump capped to a minimum height in the Z axis. However, that same button if tapped twice or or pressed again in mid-air, will make the character to perform a double jump with its thrusters.

Because the Jump button must do all of those things, I don’t know if it should go on an Axis Mapping or on an Action Mapping. I saw tutorials that always place it on Action but their jumps are fixed, so I believe I should use Axis instead but… I really don’t know if that is the best course of action :confused:

What would you pick if you wanted the Jump action to perform several different things by how long you press the button or double-tap it?

Thanks in advance!

I’d use an action.

All of the logic takes place either from a trigger or from context of when it is pressed.

An axis is more for continuous and/or smooth input like a joystick.

To get started just try to get your logic in place by using print strings only. You can have the blueprint open and set to debug the actor while in PIE. This way you can easily see the execution wires firing. It’s good to plug a print string into every execution pin even if you are not using them of the input action. That way you can see exactly how it works in real time.

1 Like

The new enhanced input system provides you with a lot of triggers and elapsed time out of box.

you should go with action.

1 Like

I think you should use actions with two triggers (on pressed and released).
image

When you press it down you check if you are already in air, if you are, you perform a double jump.
On release you can check for how long the button has been pressed, and you can use that value to scale the jump height (don’t forget to clamp it!)

1 Like

As others have said, action is best. To get it to play nicely with holding the button for a higher jump, I’ve found this works well:

The select float at the end is just for when the character grabs a jump power up. If you only need one jump height, just feed it a single <1 gravity scale value. I find it’s a lot smoother to scale gravity than having a crazy jump velocity.

Also, somewhere in begin play, bind the apex notify like so:

jumpapexjpg

This way gravity resets at top of jump, regardless of button state.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.