0
$\begingroup$

Please excuse me because I don't have a strong grasp of mathematical notation, I'm a programmer and understand code best.

I have a variable called momentum, which is tending towards 0 like this:

momentum = momentum * 0.9

This repeats every frame. But the trouble is that the time of each frame is variable. How can i make sure that the rate of deceleration is consistent even as delta time changes?

  • 0
    No it's still going to be a function of time, but i need to factor delta time in there somewhere to make it work.2011-08-02

1 Answers 1

1

How about momentum=momentum*0.9^(delta time), where delta time is the time since the last frame? It should be measured in units such that you want the momentum to decrease 10% in one unit of time.

  • 0
    It is just using the properties of exponents. $0.9^{t_1+t_2}=0.9^{t_1}0.9^{t_2}$. If you find the results are not precise, you could identify the behavior and maybe I can help.2011-08-02