   Collision/Unembedding/Pushing... and a seemingly impossible case
Hi all, I asked a few questions about Box2D a few days ago, and learned a whole lot about how that system works.  As a result of that, for fun and optimization, I'm trying to roll a stripped down system of my own for kicks, learning, and edification... with one enhancement that seems "impossible" in a simultaneous physics simulation. Impossible is usually a result of looking at things from the wrong perspective!  Show me the other angle! I want to develop a process where the density of an object, and the object's ability to display another object are two seperate variables.  Every physics simulation I've run into represents their object something like this:struct{  Point   mPosition;  Point   mMoveDirection;  float   mDensity;}For the purposes of gameplay elements, I want to represent an object like this:struct{Point   mPosition;Point   mMoveDirection;float   mStrength;float   mWeight;};Let's further say that: if ObjectA.mStrength<=ObjectB.mWeight, then ObjectA cannot displace object B.else if ObjectA.mStrength>=ObjectB.mWeight*10, then ObjectA pushes object B at normal "collision seperation."else (ObjectA pushes ObjectB at an interpolation between 0*CollisionSeperation and 1*CollisionSeperation). With those rules in mind, consider a simulation where ObjectA and ObjectB are both in motion, and they end up overlapped after their mMoveDirection has been applied. The following rules come into play: I've managed to make the whole simulation work with every condition except the very last one.  It's a problem!  There's two circles that are overlapping, but are NOT allowed to displace eachother. Can anyone think of how one would resolve this situation?  If one circle is at rest, it's pretty simple, you treat it like one of the conditions where one cannot move the other.  But if both circles are in motion, then their unembed essentially should hold them in place relative to each other-- while still granting them the ability to slide and jostle around eachother as they both push but cannot advance. (Note that conditions 1 and 2 are really the same as condition 3, just with the midpoint position weighted properly... the equation to get that is incredibly fiddly and I still haven't come up with one that works, but I think it exists) * * * I can solve "condition impossible" by making the simulation non-simultaneous-- moving each object one by one, and unembedding it and it alone, and then moving on to the next object.  The speed hit from this is horrible, not to mention you get unfair situations because whoever is higher in the list gets primacy!  So I'm looking for a way to make it simultaneous. Any ideas?
The simplest solution to resolve #3 situation is to forbid setting strength to 0. Other solution is to keep velocities unchanged and rely on separation phase. ObjectA pushes object B at normal "collision seperation."ObjectA pushes ObjectB at an interpolation between 0*CollisionSeperation and 1*CollisionSeperationis not very clear, as collisions are resolved in terms of impulseshttp://en.wikipedia.org/wiki/Momentum#Conservation (in case of elastic collision)http://en.wikipedia.org/wiki/Inelastic_collision