I believe what I am really doing is approaching my problem in the wrong way which is causing Box2D to behave the way it was designed... and (almost) fail.
In a nutshell, what I'm doing is outside of the World->Step I (sometimes) explicitly move some static geometry on and off "stage". "Stage" in this context means a play area where dynamic objects are contained within static geometry (it's a pinball table). It's really simple collision geometry, basically at some point during gameplay I place a large circle shaped body explicitly in a certain location by calling body->SetPosition. The problem is that space might be contained by dynamic objects. At this point it looks like things "freeze" up for a few seconds (sometimes shorter sometimes longer) while they get resolved? by Box2D.
I believe I've tracked it down to the following code:
http://box2d.svn.sourceforge.net/viewvc ... iew=markup.
Here an of ideas I had on solving this:
- Before placing the static geometry there, I could move the dynamic objects out of the way. I'm not sure if this is a good way to fix it.
Is there a right way to do this?
In a nutshell, what I'm doing is outside of the World->Step I (sometimes) explicitly move some static geometry on and off "stage". "Stage" in this context means a play area where dynamic objects are contained within static geometry (it's a pinball table). It's really simple collision geometry, basically at some point during gameplay I place a large circle shaped body explicitly in a certain location by calling body->SetPosition. The problem is that space might be contained by dynamic objects. At this point it looks like things "freeze" up for a few seconds (sometimes shorter sometimes longer) while they get resolved? by Box2D.
I believe I've tracked it down to the following code:
http://box2d.svn.sourceforge.net/viewvc ... iew=markup.
Code:
457 if (iter == k_maxIterations)
458 {
459 break;
460 }
458 {
459 break;
460 }
Here an of ideas I had on solving this:
- Before placing the static geometry there, I could move the dynamic objects out of the way. I'm not sure if this is a good way to fix it.
Is there a right way to do this?