# What physics mechanism do you apply for double-jumps?

This topic is 908 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

In many games, especially the parkour games, characters can jump ,and while they are still in the air, they can jump again to move further and higher.

Since this is not realistic in the real world, the physics mechanism must be defined artificially. I have three ideas:

1-Whenever the "jump" key is hit in a legal time(that is, the player have not jumped or have jumped only once), the vertical speed will be SET to a specific fixed value.

This means the second jump will bring the player to a  fixed height  above the place where he or she performs the double jump.

However, this means the greatest height is reached when the second jump  is performed at the peak of the first jump ,which is quite strange, since in most games players just hit the "jump" button rapidly twice to do highest double jump instead of waiting for a peak. Another problem with this is that since the first jump is very fast at the beginning, small difference in the time period between two jump actions will lead to a significant difference in the total height reached.

2-Whenever the "jump" key is hit in a legal time, the vertical speed will be ADDED a specific fixed value.

This means... well, the total jump height will be highly unstable, too. Simple calculation will reveal that if jumping with a speed of v reaches the height H,  a jump with the initial speed of 2v will only bring the character to 1.414 H. The strategy to reach a best height also lies in performing the second jump at the peak of the first jump.

3-Whenever the second jump is performed, the program calculates the speed it needs to reach a fixed height and set the speed as that. The kinematic energy will be added a specific fixed value.

That is, no matter when the second jump is performed, the total height of the two jumps will always be the same, even if the second jump is performed when the player is going down.(which is quite weird, too.)

That's my plans, all of which don't feel quite right when tested. What's your physics mechanism adapted for your games?

Do you apply different rules when the player is going down and up? Do you have better mechanisms for this? Please do share.

(PS: the picture below is from the parkour game Oven Break, which I tried to analyze its double jump mechanism but failed...)

##### Share on other sites

I wouldn't worry about physical accuracy but just go for something that feels right. I like the sound of option 1 as I feel that rewards timing/player skill. I would have the second jump override the first jump as if it started from stationary as that would also give the player more control. The only real option is to try all 3 and see how they feel or find a game with a double jump mechanic that you like and try to imitate it.

##### Share on other sites

When I was working on a platformer game I realized that the double jump "feature" is in fact a bug that occurs when code is written to allow jumping (through an increase in vertical velocity) to be possible when vertical velocity is == 0 (or maybe <= 0). This occurs both when your character is standing  on the ground and when he's at the high point of his jump.

So um... I didn't specifically try to create the effect, it was just an accident. Maybe there's a specific implementation that will create a more ideal user experience for the game that you're working on. As much as it'll be about what feels right it'll also be about what sort of obstacles you want to include in your game.

##### Share on other sites

100% realistic

>> Do you apply different rules when the player is going down and up?

just one set of laws: the laws of physics. IE: gravity, conservation of momentum, etc.

>> Do you have better mechanisms for this?

can't beat reality.

for a parkour game, you want that "magic float" capability. sort of like in crouching tiger hidden dragon. you can't jump while airborne, but you don't fall fast, and you travel far. when you jump, its not so much about how high, as it is about hang time.

##### Share on other sites

Option 1 is most common for platformers at least and I find it most satisfying as a player. Option 3 seems really strange to me.

##### Share on other sites

Dude... all you do is apply positive force along the Y-axis. If you have a proper setup for a physics system and bodies, just apply force. Tweak the amount of force until it feels right for the gameplay desired. I guess if you wanted to make sure the player reaches a specific height, than yes you can include an extra step and interpolate the amount of force necessary to reach the desired height.

##### Share on other sites

Option 1 in my opinion, depending on the style and control of the game you could have a small time window near (around) the apex of the first jump, that reduces the skill required to land the second jump action, but also contains a learn-able "skill" for getting the timing in the middle of the apex and thus gaining more height with the second jump timing.

##### Share on other sites

When I was working on a platformer game I realized that the double jump "feature" is in fact a bug that occurs when code is written to allow jumping (through an increase in vertical velocity) to be possible when vertical velocity is == 0 (or maybe <= 0). This occurs both when your character is standing  on the ground and when he's at the high point of his jump.

So um... I didn't specifically try to create the effect, it was just an accident. Maybe there's a specific implementation that will create a more ideal user experience for the game that you're working on. As much as it'll be about what feels right it'll also be about what sort of obstacles you want to include in your game.

Wow, really? Should it be like that way, players would be able to ... jump any number of times, since every jump reaches its own apex where v==0. Many games can do at most 2 times.

Oh, do you mean this is the origination of double-jumps? Well ,in that case, thank you for telling me this. That was fascinating.

##### Share on other sites

Thank all you guys for replying! That's  helpful and  I will tell my group leader, who prefer the third plan your ideas.(And see if she changes her mind.)

I don't know why, but I can only reach gamedev.net when I'm in the teaching building. The wifi in my dorm doesn't seem to give me access for this website, and that's part why I didn't reply you till today. :huh: (And part because homework has overwhelmed me)

##### Share on other sites

can't beat reality.

I couldn't disagree more with this.  The faker the physics, the better... of course there are always exceptions, but these games are usually most fun when the designer is cognizant of the fact they're breaking this rule.

1. 1
Rutin
28
2. 2
3. 3
4. 4
5. 5

• 13
• 11
• 10
• 13
• 20
• ### Forum Statistics

• Total Topics
632949
• Total Posts
3009412
• ### Who's Online (See full list)

There are no registered users currently online

×