I am in the process of developing a 2D digging game for mobile. I need an efficient method to dig tunnels through the levels (Similar to the game play in Death Worm), and build colliders around the tunnels.
How would I go about it?
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.Sign up to join this community
You should look into isosurfaces (mainly marching squares)
The idea is very simple, you have points in a 2d space, each of them has a value between 0 and 1 attached to them.
Whenever the terrain changes you need to run the points through the marching squares algorithm and that gives you a mesh around the contour of the points with a value higher than a certain threshold.
If you want to dig a hole in the mesh, then you can get every point in a certain radius from the center of the bew hole and decrease their value so it will be under the thresholdof the algorithm.