Today we are looking at a powerful 2D open source library for the Godot Game Engine that enables you to dynamically fracture 2D polygons. The Godot Polygon 2D Fracture project is available on Itch.io as well as having the source code hosted on GitHub under the MIT source license. The author SoloByte created the fracture library to create the game Nomads Sky, which is also available on Itch.io and is predictably enough written using Godot.
The authors description of fracture for Godot from Github:
Works with GodotEngine 3.2+ Tested with Godot Versions: 3.2.3, 3.3, 3.3.1
Two simple scripts for fracturing and cutting polygons. PolygonFracture.gd is the actual script that fractures/cuts polygons. PolygonLib.gd adds nice helper functions for polygons like calculateArea, triangulate, getRandomPointsInPolygon, getBoundingRect, makeCirclePolygon, etc.
The final scripts are located in the polygon2d-fracture folder. The demo project is located in the demo folder.
The pool manager script added in [Update v1.2.0] is just a bonus. You can use it as is or use it as inspiration for your own pooling system 🙂
The demonstration projects show how to cut and shatter 2D polygons, including textured polygons, and the fracturing process can use one of two available algorithms, Delauny and Cut Line system. There are also samples illustrating projectile collisions and the library also includes a simple polygon utility library as well as an object pooling implementation, all of which are implemented entirely in GDScript. You can learn more about the Fracture library for the Godot game engine as well as learn how to navigate the code in the video below.