Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Zeu5

Smoothing a variable in time

This topic is 5493 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
Something like:
alpha = alpha^time
x = x*alpha2 + NewX*(1-alpha2)

time being scaled as necessary, with a thresdhold.

Share this post


Link to post
Share on other sites
double const Ajdustable_constant = -0.05;
alpha = exp(Adjustable_constant * time_elapsed);

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!