Hi All,
Been implementing a 2d sequential impulse engine (mostly for the academics of it). The main pipeline of my current engine is:
1) Detect Collisions
2) Resolve % of each penetration
3) Repeat 1 & 2 'n' times
3) Resolve velocities
4) Integrate
5) Repeat
This seems to give fairly descent results. However, no matter what I try when objects stack in vertex-edge configurations, or edge-edge in pyramid-like structure, then the angled objects will push others out of the way regardless of how many objects are in the pile being pushed. Here are some videos showing the results:
Initially I thought there was something wrong with my friction implementation but I've tried increasing friction to no avail. Next, for edge-edge cases I only resolve a single contact, so I've experimented with different contact points also to no avail.
I can only think of two things which may be causing this, either:
1) This is un-avoidable for a sequential impulse solver -- which doesn't feel entirely correct. sliding from sequential solvers should be gradual drifts; not this dramatic but perhaps I am wrong.
2) Steps 1 & 2 in my loop place a large emphasis on resolving penetrations (via position corrections) rather than giving more weight to #3. As I've been reading around online, it seems many don't even do #2 but rather only resolve the velocity by applying the appropriate impulse plus some small portion of the penetration (baumgaurte stabilization?).
As far as my penetration resolution implementation: it resolves the penetrating objects in the direction of the contact normal according to the objects' mass. Each pair is resolved in the order of greatest separating velocity.
Simple answer seems to be put everything to sleep.... though I feel like that's just masking a stability problem.
I'd appreciate any feedback on the ordering of my main loop, and any suggestions on what may be causing my stacks to push apart / how I might be able to mitigate that? Would a TOI solver fix this, or is simultaneous resolution the only answer? Anyways, I feel like I have lots of ideas, but no clear direction; so some guidance would be very helpful.
Let me know if you need more info from me.
Thanks