4 ms·
The trick is to only apply positive impulses and discard negative ones: https://github.com/IainWinter/IwEngine/blob/6f94a946a90db989412ff29320a0baeca7a5f8cb/IwE
by johndough 6y ago
The trick is to only apply positive impulses and discard negative ones: https://github.com/IainWinter/IwEngine/blob/6f94a946a90db989412ff29320a0baeca7a5f8cb/IwEngine/src/physics/Dynamics/ImpulseSolver.cpp#L26 https://github.com/IainWinter/IwEngine/blob/6f94a946a90db989... Things will sort themselves out over several frames.
Objects might sink into each other a bit, but that is generally not very noticeable unless you make huge piles of spheres. However, it might quickly become a problem in 2D, since you only need a quadratic number of objects to get a "critical" pile, compared to a cubic number of spheres in 3D.
- IainWinter 6y agoThat makes it so nothing explodes, and then there is a second solver that does a small raw position correction after. So it's not lifelike realism, but it works to stop objects sinking into each other too much. There is still a small error though, I'd have to look into more iterations and all that.