Variable timestep with variable iterations?

Greetings,

I tried implementing the gafferongames logic as well, but also had extreme jerkiness. After countless hours tweaking and searching, I found this post and it works best for me (no jerkiness):
viewtopic.php?f=4&t=3027 (2nd post down).

Code from that post:
Code:
double max = _dt*2.0;
  while (deltasec>=max && !_quit)
  {
    m_world->Step((float)_dt, _iters);
    deltasec -= _dt;
  }
  m_world->Step((float)deltasec, _iters); //This syncs up the physics engine to the current frame


It's worth noting that this is more of a fixed-variable timestep solution. It processes a variable timestep unless more than 2*timestep time has passed, in which case it processes the timestep in discreet fixed timesteps (and then does a varaible timestep with the remainder). I also have pre and post timestep processing that I do before and after both Steps (the one in the loop and the one after the loop).

Another useful addition (that I did get from gafferongames) was to clamp the deltasec to a reasonable amount (like .25 secs). That way if the game is paused for a long, long time (and then resumed) I am not waiting forever for the physics to catchup. (I just toss the whole deltasec value (if > 0.25) and set the deltasec to the fixed-timestep. Seems to work very well...

So here's my question:

My main concern here is the iteration counts. Right now they are always 10 and 10 for both Steps.
Since the varaible timestep can be just under 2*tmesteps in length, should I increase the iterations by a factor so that longer (variable) timesteps get more iterations and small fractional (variable) timesteps get fewer iterations?
The hope would be that it would allow collisions to be more accurate (and avoid tunneling) when the (variable) timestep is larger. But not understanding the box2d internals makes me wonder if there would be unexpected side effects that might not be immediately apparent.

Regards,
Q
Iterations do not affect collision detection. They only affect collision/contact/joint resolution.
Erin,

I understand now. Thanks.

However, I am still wondering if doing more or less interations (based on the size of the varaible timestep would be a good idea, if only to be more efficient? Oftentimes with the above logic the time step range can be quite large so (for example):

The iteration count is set to 10 for every .020 seconds of (fixed) timestep (inside the while loop)

Then I could process the variable timestep by a factor so that:
So a variable timestep of 0.039 would get an iteration count of 19
and a fractional (variable) timestep of 0.002 would get a iteration count of 1

This way the larger the timestep the more iterations and the smaller timesteps get fewer interations

Just wondering if it a good idea (for efficiency) or bad idea (possible side effects)....or perhaps bad idea for some other reason?

Thanks,
Q
The whole idea is to use a fixed physics time step and iteration count. As it stands you are completely breaking from this, so it is all heuristics at this point.

Original thread: https://box2d.org/forum/viewtopic.php?t=4907