Smoothing a variable in time

Started by
1 comment, last by Zeu5 20 years, 10 months ago
Hi all, I have to smooth the value of a variable (x) over the time. The formula I''m using is: x = x*alpha + NewX*(1-alpha) with some smoothing parameter ''alpha'' in the interval [0,1]. This code is called once per frame, my problem is that the "smoothing velocity" of the variable clearly depends on frame rate. I have the time passed since last calculation. How can I use this time parameter to make sure that the smoothing velocity is always the same regardless of the framerate? Any idea? Thanks.
Advertisement
Something like:
alpha = alpha^time
x = x*alpha2 + NewX*(1-alpha2)

time being scaled as necessary, with a thresdhold.
double const Ajdustable_constant = -0.05;
alpha = exp(Adjustable_constant * time_elapsed);

This topic is closed to new replies.

Advertisement