Skip to content

Commit facc8d8

Browse files
authored
Update README.md
1 parent 7525d12 commit facc8d8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,23 @@ There are two different systems for fracturing polygons.
6161

6262

6363

64+
## Restoring
65+
66+
![](gifs/polygon-fracture-restore-simple01.gif)
67+
68+
I added two different methods of restoring polygons to their original state.
69+
70+
### Simple
71+
The simple method uses the polygonRestorer.gd script. This is a simple class with an array(stack) of polygons. Each polygon represents a state. The last element represents the previous polygon, the first element represents the original polygon. The user can add new shapes, get the original state, the current state or the previous state with simple functions.
72+
73+
### Advanced
74+
The advanced method just uses 1 function in the polygonLib.gd script. The simple method stores the states of the polygon and can restore each state. The advanced method grows the polygon by a certain amount while restricting it to the original polygons shape. In other words: the simple method can only restore discrete states while the advanced method can restore any amount in between. Unfortunately the advanced method comes with a bigger performace cost. As seen in the demo, it should not be a problem using it every now and then but restore intervals below about 0.2 seconds can slow things down significantly.
75+
76+
I would suggest just testing it because as always it depends on how and for what you want to use it ;)
77+
78+
79+
80+
6481
I need the fracturing for my game but I thought I share it with anyone interested. My method is not the best or most performant method out there, and also implemented via GDScript (for ease of use), so don´t expect any performance miracles. There are other solutions out there, but I did not find a simple solution for fracturing 2d polygons in the way I wanted. Maybe sometime in the future, I will look into Voronoi fractures, to make the fractures look better. (Now the polygon is just randomly fractured)
6582

6683

0 commit comments

Comments
 (0)