Algorithms - Gravity
Updated at 2012-06-24 15:00
Algorithms related to gravity.
When delta_time
is too high or too low, causes unwanted problems, e.g., gravity depending on rendered frames per second. In fact, you should use this to all accelerating forces.
# bad
velocity = velocity + (gravity * delta_time)
position = position + (velocity * delta_time)
# good
velocity = velocity + (gravity * delta_time / 2)
position = position + (velocity * delta_time)
velocity = velocity + (gravity * delta_time / 2)