I have an ArticulationBody with a relatively large number of joints that interacts via capsule colliders with a static mesh collider. This works pretty well under most conditions, using continuous collision detection to keep within the constraints of the mesh. However, if I push hard enough into a tight space, it’s possible to cause a joint constraint violation as a component gets stuck, which can then start to propagate to worse and worse constraint violations until finally NaNs start appearing in the solver and the Unity editor crashes. This is an undesirable outcome.
I’m working on improving the stability of the system, but one thing I’m also considering as a further layer of protection is some sort of stopgap to detect that things have destabilized and restore to a prior known-good state. Basically, I would take snapshots of the hierarchy state over time, measure some heuristic of how stable the joints solution is, then, if the heuristic exceeds some bounds, go back in time to a prior stable state. This will manifest to the player as a weird ‘bounce’ discontinuity, but it’s not so different from ‘anti-stuck’ mechanisms with character controllers.
My question: is this kind of reversion of the physics state a known mitigation for problems like this and are there are any suggestions for how to compute the stability heuristic? From what I’ve observed, the first sign that things are about to go wrong is that some of the rotary joint anchor points become displaced from their parent anchors.