Ignore this suggestion. I made an updated suggestion on how to tweak the physics engine settings to fix the problem altogether.
~~It sucks when the physics glitch out and make your items go flying at mach 1. This suggestion doesn't fix the issue entirely, but would make it less frustrating with minimal effort. The idea is to prevent the item from flying off if it suddenly starts glitching out:
-
Check the squared length of the items velocity vector. If it exceeds a value that is unrealistic to achieve through normal interaction proceed to step 2
-
Check if the item is colliding with anything. If it is then wait for the collisions to be resolved
-
Set the items velocity to 0 or alternatively you can normalise it and multiply it by a lower value to keep some of the velocity
The check is relatively inexpensive and can be performed on every item every frame, but if you want it to be a bit more optimised you can limit it to only a handful of items per frame~~