So the overall logic would be when a collision occurs see how hard of a collision it was and if it was hard enough break the object up.
Seeing how hard the collision was should be a matter of looking at the difference of kinetic energy (KE=0.5*mass*velocity^2) of the object before and after the collision. You can do that by saving the KE to a variable at the end of a tick to reference later.
Breaking the object up is either done with pre-made pieces or by somehow breaking it up dynamically.
The pre-made pieces way is the more doable approach. There are two ways to do it though.
1. Destroy the main object and create all the pieces.
2. Just have all the pieces joined together with joints which are later unjoined.
There are pros and cons of either. With 1 you’ll need to be able to place the pieces in the right position and angle, as well as set their linear and angular velocity from the original object.
With 2 setting up the joints between the pieces can be tedious, and you’ll need a way to look at all the pieces as a group with events. Also joints tend to be springy, and you may need multiple joints between pieces to keep them from rotating.
Now the fanciest approach would be to dynamically break the objects up as needed. For that we need to be able to change the collision polygon and what is drawn. For c2 you’re out of luck there with vanilla features, but in c3 you can in theory do it with the distort mesh feature. However it wasn’t meant for that sort of thing so some creative use will be needed.
Anyways, using mesh distort as a tool we will want a way to slice a convex polygon into two separate convex polygons. With multiple cuts we should be able to break the objects up. There are many ways we can take the idea from there such as making the breaks originate from the contact points and use voroni cells to change up how it breaks.
Anyways that’s a general overview. There are probably lots simplifications that can be done to make it more feasible.