Timeline for How can I implement gravity?
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 2, 2012 at 18:18 | history | edited | tenpn | CC BY-SA 3.0 |
cluebat
|
Nov 2, 2012 at 17:08 | comment | added | sam hocevar | @tenpn it is still no true that ensuring a constant framerate will produce correct results; see for instance lol.zoy.org/blog/2011/12/14/understanding-motion-in-games for an explanation | |
Nov 2, 2012 at 10:10 | comment | added | tenpn | Fair enough. Edited. | |
Nov 2, 2012 at 10:10 | history | edited | tenpn | CC BY-SA 3.0 |
explain framerate independence
|
Nov 2, 2012 at 0:48 | comment | added | sam hocevar | Your arguments make sense, and the inaccuracy is often not a big deal. But you should not claim it is a “proper frame-rate independent” integration, because it just isn’t (framerate independent). | |
Oct 31, 2012 at 12:55 | comment | added | Ilmari Karonen |
You can fix most of the issues with Euler integration simply by replacing position += velocity * timestep above with position += (velocity - acceleration * timestep / 2) * timestep (where velocity - acceleration * timestep / 2 is simply the average of the old and new velocities). In particular, this integrator gives exact results if acceleration is constant, as it typically is for gravity. For better accuracy under varying acceleration, you can add a similar correction to the velocity update to get velocity Verlet integration.
|
|
Aug 2, 2012 at 15:37 | vote | accept | L.P | ||
Nov 1, 2012 at 14:29 | |||||
Aug 26, 2011 at 16:35 | comment | added | tenpn | ...good link though. ;) | |
Aug 26, 2011 at 16:28 | comment | added | tenpn | I understand how Euler is inaccurate over time, but I think there are scenarios where it doesn't really matter. As long as the rules are consistent for everyone, and it "feels" right, it's fine. And if you're just learning about phyiscs, it's very easy to remember and implmenet. | |
Aug 26, 2011 at 16:18 | comment | added | Martin Sojka | Don't use Euler integration. See this article by Glenn Fiedler which explains the problems and solutions better than I could. :) | |
Aug 26, 2011 at 16:08 | history | answered | tenpn | CC BY-SA 3.0 |