3

I'm trying to make a worms-like terrain, but I'm a little confused on how to accomplish that.

I'm trying to add a new Spritemask based on my collision point, but I need to re-draw or ignore my Polygon Collider 2D Under the spritemask.

enter image description here

Is there any way to ignore my collider over the mask and make my player go "into" the hole ? Or I'm going the wrong way and there have a better way to accomplish that ?

Thanks all

Lucas Freitas
  • 1,016
  • 4
  • 16
  • 37

1 Answers1

0

One way to do it is to remove the collider and add it again, it will automatically fit into new sprite shape.

Delete(GetComponent<PolygonCollider2D>())
AddComponent<PolygonCollider2D>()

It works but is quite slow, so it is ok for worms-like game.