A simple script for fracturing polygons. Also adds nice helper functions for polygons like calculateArea, triangulate, getRandomPointsInPolygon, getBoundingRect)
New Polygon Restore Systems:
2 new demo scenes to showcase the restore functionallity.
New function for creating Superellipse polygons. Thanks to The Coding Train
New function for creating Supershape polygons. Thanks to The Coding Train
-> Check out The Coding Train on GitHub or on the Website.
Sometimes after cutting a polygon, 1 half disappeared while the other was spawned. Probably happened with fracture shards too. (but was not noticeable because so many fracture shards were spawned. As it turned out, triangulating a polygon sometimes produced very small triangles where my area calculation code produced invalid areas (-1.#IND) causing all code using that invalid area to produce invalid polygons. These small triangles had such a small area that probably through float imprecisions a negative value (instead of 0) was used in sqrt causing the -1.#IND values. The triangle area code now returns 1.0 if a negative value is detected.
The cut line system in the cut fracture test scene was improved. Looks more like Fruit Ninja now xD.
It is now possible to cut polygons with other polygons and fracture the cutouts. Funcs for creating simple polygons were added to PolygonLib.gd.
Contains the 2 final scripts for fracturing polygons and the demo project to showcase the fracturing.