Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by antk · Feb 14, 2014 at 06:30 PM · physicsdouble jump

Double Jump Physics

Hello everyone,

Can someone please explain double jump physics to me? I am trying to code this as a special suit in my game. It works, but I'm not sure if it's working as expected. The double jump height is different depending on when the double jump is initiated. If double jump is initiated before the peak of the first jump, the character jumps much higher than if double jump is initiated when the character is at the peak of or falling from the first jump.

Am I making sense? Could someone explain the physics to me and what the proper physics should be?

You can try it out on this demo I've been working on (a sidescrolling endless runner): http://fanqu.net/demo/. Click play to start the game, left mouse click or spacebar to jump. If you jump twice really quickly, you can see the cube jumps really high. But if you jump once, then wait for the player to start falling and try to jump again, you can see the second jump is much smaller.

Thanks all.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image antk · Feb 14, 2014 at 09:22 PM 0
Share

I found an article after some better google keyword searching. The article is pretty helpful describing a few jumping techniques.

http://poemdexter.com/blog/jump-physics-games/

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Phillipus · Jul 15, 2015 at 01:17 AM

If you are causing the character to jump by adding force to the rigidbody, then the problem is pretty simple. When the character is after the peak of the jump, if you add an upward force to the character then the force first counteracts the downward velocity, then pushes the character upwards. If the character is before the peak then the force is simply added to their current velocity, resulting in a higher jump.

One possible solution to this problem would be to check the character's velocity before adding force and accounting for the difference, or setting the velocity to 0 before adding the force. Although both would result in the same outcome, the latter is probably easier to implement.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make correct double jump with collor changing? 0 Answers

Double-jump mechanic has an initially high jump 1 Answer

2D 360 degress platformer example needed 0 Answers

Rigidbody2D.velocity affects the y-axis, but not the x-axis. 1 Answer

Can I make physics engine speed dependent on frame rate? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges