Re: [Algorithms] Formula for Damping f times
Brought to you by:
vexxed72
From: Alen L. <ale...@cr...> - 2009-06-05 11:49:14
|
Paul wrote at 6/5/2009: > x *= 1.0f-(k*deltaTime); Note this: x1 = x0*(1-k*d) x2 = x1*(1-k*d) = x0*(1-k*d)*(1-k*d) = x0*(1 - k*2*d + k^2*d^2) If you skip and do two steps at a time: x2 = x0*(1-k*2*d) So, this formula does not behave well with step variance. OP didn't state he requires this explicitly, but it is important to note as it can cause weird results later if you don't pay attention to that. I'd prefer using pow(), as Fabian described, unless performance is extremely critical there. JM2C, Alen |