Timeline for Inconsistent jump height
Current License: CC BY-SA 3.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 28, 2017 at 19:49 | vote | accept | Martin | ||
| Jul 27, 2017 at 20:36 | answer | added | Martin | timeline score: 1 | |
| Jul 27, 2017 at 19:26 | comment | added | leetNightshade | How are you determining for how long to apply the jump? If dt is large you can overshoot your jump time if you apply full dt to applied velocity for jump. If dt is small it should be fine. What's your jump code look like? | |
| Jul 26, 2017 at 20:14 | comment | added | DMGregory♦ | This is something called integration error. The Euler integration method you're using is particularly susceptible to this, with error per step proportional to the square of the step size. So as your timestep varies, the result changes quite wildly. You can reduce the error by using more sophisticated integrators like RK4, but they'll always have some timestep sensitivity. Switching to a constant timestep as Bálint suggests will guarantee you get consistent results even if your integrator is simple. | |
| Jul 26, 2017 at 20:13 | comment | added | Martin | I think the answer is in the accepted answer to this question, but I can't quite see how it translates to my algorithm. gamedev.stackexchange.com/questions/45704/… | |
| Jul 26, 2017 at 20:11 | comment | added | Martin | Although, I'd have to say I prefer jumping lower on low frame rates because jumping higher leaves an exploit to reach places you're not supposed to reach. | |
| Jul 26, 2017 at 20:09 | comment | added | Martin | It doesn't matter how small dt is, the jump height will always be variable to some degree when dt varies with this technique and it will. I'm pretty sure I'm doing something fundamentally wrong because I've never seen a professional platformer where the character jumped higher/lower on different frame rates. | |
| Jul 26, 2017 at 20:01 | comment | added | HolyBlackCat | @Bálint Why does OP have to change the order? | |
| Jul 26, 2017 at 19:52 | comment | added | Bálint | gafferongames.com/post/fix_your_timestep | |
| Jul 26, 2017 at 19:44 | comment | added | Martin | Then the jump height will be higher than usual when the framerate decreases. | |
| Jul 26, 2017 at 19:40 | comment | added | Bálint | You move after you change the velocity, change the order of them | |
| Jul 26, 2017 at 19:30 | history | asked | Martin | CC BY-SA 3.0 |