Hi everyone,
I've implemented a simple 3D rigid body physics engine using a substepping-based XPBD solver as described by Muller et al: https://matthias-research.github.io/pages/publications/PBDBodies.pdf. For narrowphase collision detection, I'm using the separating axis test to generate 4 point contact manifolds following Dirk Gregorius' GDC 2015 and 2013 talks: http://media.steampowered.com/apps/valve/2015/DirkGregorius_Contacts.pdf.
The problem I'm running into is that I don't know how to properly leverage the 4 contact points when performing the positional update to resolve a contact (Muller et al assumes one point per contact). Currently, I just iterate through all 4 contact points sequentially for each contact, but this causes simple cases like a cube falling on a flat plane to exhibit an improper torque on the bounce (the resulting rotation depends on which cube corner contact is processed first):
Ideally, I'm looking for a way to derive a single positional update from the 4 points in my contact manifold. For the video above, obviously the ideal positional update would be to the middle of the bottom face of the cube, which would resolve all 4 contacts with no rotation.
Intuitively, it seems like in general it should be possible to carefully pick a single point in between the 4 contact points, where the proper correction magnitude applied to that point ensures all 4 contacts have been resolved (with no extra work done). Unfortunately, I'm not sure how to formulate these positional constraints. There seems to be quite a bit of discussion on this forum from a few years ago for doing this for impulses, in particular the direct enumeration method used by Box2D. However it seems like this would be quite expensive in 3D (2^4 cases), and the rigid bodies XPBD paper doesn't go into quite enough detail for me to fully understand how to build the necessary LCP in the first place for positional updates. Is there any way to simplify the problem leveraging the fact that all 4 contacts have the same normal or some property of positional updates?
I'd appreciate any suggestions / pointers!