   air resistance over time
  hi there, I'm trying to add correct air resistance into moving objects, currently I'm just multiplying the velocity by some number between 0-1 every frame so that it reduces, which is fine but when the framerate is low the objects take longer to slow down:void Object::update(unsigned dTimeMs){   this->velocity += this->acceleration * (dTimeMs/1000.0f);   this->velocity *= 0.8;   this->position += this->velocity * (dTimeMs/1000.0f);}I'm not looking for accurate air resistance but I need a way to scale the velocity towards zero at a fixed rate, so that the rate will remain the same when I call this function at different framerates. Any Ideas?   
  Moving to Math & Physics.   ;  I had a similar problem for rotation. varying frame rate was the cause.I came up with a simple super duper elegant solution. :DCalculate the frame rate, calculate the multiplying constant wrt the frame rate.Hope that helps.There is always a better solution, and a better solution should be always used.;   float airResistance = someConstant*this->velocity*this->velocity;   this->velocity += (this->acceleration-airResistance ) * (dTimeMs/1000.0f);   this->position += this->velocity * (dTimeMs/1000.0f);"someConstant" depends on the object... but since u didnt want an accurate calculation i left that out...   ;  To expand on what Dragon_Strike said, the actual formula is as follows:F = -1/2 * V^2 * A * Cd * rhowhere: F - value of the drag force [N] V^2 - squared speed [m/s] A - frontal area of object, where "frontal" means directed towards move direction [m^2] Cd - drag coefficient (in range 0 - 1) rho - density of air = 1,168 kg/m^3As you can see A, Cd and rho can be chosen empirically so you end up with one constant as Dragon_Strike pointed out:C = -1/2 * A * Cd * rhoAnd then the equation simplifies to:F = C * V^2   ;  If you want frame-rate dependent damping (which isn't the same as air resistance), then you want your variable become half its original value in time T:time t = 0, x = Xtime t = T, x = X/2over that period T, each update of time dt you multiply x by f. That means over the whole time period you want:X * f * f * ... * f = X * f^(T/dt) = X/2so f = 0.5^(dt/T)i.e. each update multiply your damped variable by 0.5^(dt/T) where dt is the timestep, and T is a constant (the time you would want your variable to decay to half its original value). The bigger T is, the smaller the damping.Obviously you only need to evaluate f once per system update, so calculating the power function shouldn't be a problem.   ;  It's not perfect but I often use this sort of thing. It's got a few slow function calls in it but at least it's resistant to changes in frame sizevoid Object::update(float timeDeltaSec){   float currentSpeed = this->velocity.Length();   float drag    = currentSpeed * currentSpeed * someDragCoefficient;   this->velocity = this->velocity * exp(-timeDeltaSec * drag);};Quote:If you want frame-rate dependent damping (which isn't the same as air resistance), then you want your variable become half its original value in time T:Thanks, this is what I was looking for.   ;  What's really going on here (when you "vary the damping constant") is that you're solving a differential equation using Euler's method and a varying timestep.   