Releases: SoloByte/godot-polygon2d-fracture
v2.0.0
What's Changed
Godot Polygon Fracture is now available for Godot 4.2.2+.
Many thanks to @olixis for doing all the work on this one. (Changes to make the lib compatible with godot 4.0+ by @olixis in #6)
- The main scripts were ported to Godot 4.2.2 as well as all the demo scenes.
- The structure and logic of the fracture system stayed the same.
- I overhauled the branding a little bit with a new banner & social preview image.
For users of Godot 3 the older releases can still be used and I created the 1.4.x branch for any further development. The main branch is now for Godot 4.2+.
New Contributors
Full Changelog: v1.4.0...v2.0.0
Polygon Restoring and Supershapes
Features
-
New Polygon Restore Systems:
- Simple via the new Polygon Restorer class.
- Advanced via a new function in the Polygon Lib class.
-
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.
Texture System and Point Fracture System
Features
- Texture System -> Fractured polygons can have textures now.
- Point Fracture -> Just use a single point and a randomized polygon for this new system.
- Scale System -> Scaled things can be cut/fractured now.
- Fracture Shard -> simple fake rigid body if you don't want to use the physics system. (like collisions)
Cleanup
- General Code Clean up.
- Polygon Lib uses only transforms now.
- Polygon Lib no longer rotates the source polygon but transforms the cut shape into the source's local space.
- License text added to all gd files.
Pool Memory Leak Fixed.
Hotfix
- pool instances were not freed on game exit
New overhauled Mouse Cut System
Important Bugfixes
- Triangle area calculation sometimes returned invalid integers causing corrupt polygons
Added Functionality
- New SimplifyLine Code (Ramer-Douglas-Peucker algorithm -> thanks to https://thecodingtrain.com/CodingChallenges/152-rdp-algorithm.html)
Mouse Cut System Overhaul
- Now instead of always drawing a straight line, the path of the mouse is traced, simplified, and converted into a cut shape.
- The input system was unified to 1 button so it works on touch screens too. (HOLD LMB for cut lines, Tap LMB for simple circle cut)
Bonus
- I implemented a simple pool manager script for handling "fracture bodies" and "cut shape visualizer". You can use it as is or use it as inspiration for your own pooling system :)
Disappearing Polygon Bug Fixed. Demo Improvements: New Cutting Line System.
Disappearing Polygon Bug Fixed
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.
Cut Line System Overhaul
The cut line system in the cut fracture test scene was improved. Looks more like Fruit Ninja now xD.
Added cutting of polygons.
It is now possible to cut polygons with other polygons and fracture the cutouts. Funcs for creating simple polygons were added to PolygonLib.gd.
Godot Polygon2d Fracture
Contains the 2 final scripts for fracturing polygons and the demo project to showcase the fracturing.