4 ms·
From building a rigid body physics engine decades ago I remember that stacking was a very hard problem. The best solution at the time to avoid objects sinking i
by rollulus 3y ago
From building a rigid body physics engine decades ago I remember that stacking was a very hard problem. The best solution at the time to avoid objects sinking into the ground was to create a directed acyclic graph, starting with the ground and pushing bodies outward. It required multiple iterations to converge and felt very hacky. Does anyone know if this problem has been solved nowadays? I couldn’t find any mention of stacking in this project.
- QuadmasterXLII 3y agoThe author of Box2D just put out a fantastic blog post on exactly that subject: https://box2d.org/posts/2024/02/solver2d/ https://box2d.org/posts/2024/02/solver2d/ The author's video linked at the bottom of the post shows how each solver handles various hard stacking problems https://youtu.be/sKHf_o_UCzI https://youtu.be/sKHf_o_UCzI
- TinkersW 3y agoStacking works fine today.. you don't need a acyclic graph, just run the solver for enough iterations and it will converge, multiple iterations is to be expected given the number of contacts and friction constraints involved. If you track the max residual you can run until it reaches ~0. The only kinda busted aspect is that collision & solver only runs at some limited update rate, so if you start with penetration it needs to resolve that, which is kinda "fake" since real world objects don't penetrate like that, so this can add extra motion and make the stack less stable, but there are various methods to work around this, all the popular physics engine have some solution or another.