A Godot Engine script for fracturing and cutting 2D polygons, with helper functions for polygon manipulation.
Godot Polygon2D Fracture is a GDScript library for the Godot game engine that provides tools for fracturing, cutting, and manipulating 2D polygons. It solves the problem of creating destructible objects and environments in 2D games by offering multiple fracture methods and polygon utilities.
Godot developers working on 2D games that require destructible terrain, interactive geometry, or visual fracture effects.
Developers choose this for its simplicity, integration with Godot's workflow, and comprehensive feature set including cutting, fracturing, and restoration, all implemented in accessible GDScript.
A simple script for fracturing polygons. Also adds nice helper functions for polygons like calculateArea, triangulate, getRandomPointsInPolygon, getBoundingRect)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Offers Delaunay triangulation for triangle fractures and random cut lines for polygon fractures, providing flexibility for different visual effects as shown in the demo GIFs.
Includes both simple stack-based restoration and advanced gradual restoration, allowing for undo functionality or animated healing effects, though advanced restoration has performance costs.
Supports cutting and fracturing polygons with textures, maintaining visual consistency in games, as demonstrated in the point fracture system GIF.
PolygonLib.gd provides functions like calculateArea, triangulate, and shape generators (e.g., circle, rectangle), simplifying polygon manipulation without external dependencies.
Implemented in GDScript for ease of use, making it less suitable for high-performance scenarios; the author admits it's not the most performant method.
Uses random cut lines, leading to less controlled or predictable fractures compared to Voronoi methods; the author notes future plans for Voronoi fractures for better looks.
The advanced restoration method can slow down significantly with restore intervals below 0.2 seconds, limiting real-time usage in fast-paced games.