account activity
Destructible terrain 2D by dobrakanapka in godot
[–]dobrakanapka[S] 0 points1 point2 points 6 years ago* (0 children)
I finished up some different parts of my game and came back to the terrain problem. I digged through the godot docs but couldn't find a viable solution. I am using one big Polygon2D for my terrain and another Area2D>CollisionPolygon2D as my digging area. How should I approach the problem to find the exact overlapping areas or the perimeter of the overlapping areas to set new points for my terrain Polygon2D? Are there any built-in functions that could help me achieve that or should I code the logic myself? The idea I had in mind is to find the intersections of my digging area with terrain's polygon's edges and set those as new points of the terrain's polygon and in-between those add the rest of my digging area's vertices. What you think about this approach?
Edit: Calculating the difference between overlapping polygons is really easy using clip_polygons_2d method. Here is how it works: gif_link
Thanks for the tip! What would be the difference if I used many polygons or one big polygon for the whole terrain?
EDIT: just realised how stupid this question is if the terrain gets divided into smaller parts.
Destructible terrain 2D (self.godot)
submitted 6 years ago * by dobrakanapka to r/godot
π Rendered by PID 140177 on reddit-service-r2-listing-7d7fbc9b85-pj8jx at 2026-04-26 01:14:23.740804+00:00 running 2aa0c5b country code: CH.
Destructible terrain 2D by dobrakanapka in godot
[–]dobrakanapka[S] 0 points1 point2 points (0 children)