Concave Colliders : the pac-man case

2DDL Documentation

One of the features of 2DDL, is the speed at which it runs on standard processors. This benefit has a cost, and the biggest cost is that it doesn’t work well with concave collider. This means that we, by hand, must break any concave collider into several colliders.

Let’s start with an example, the pac-man example:

1. Create a new sprite (GameObject → 2D Object → Sprite). Call it “pacman”

2. Drag the pac-man sprite located in “2DDL/Textures/” to the Sprite property field.


3. Create a Empty GameObject, call it “collider1” and set it as a child of “pacman”.

Important Note

Why is convenient to make the collider a child?
a. It doesn’t allow Unity to fit the collider based in your mesh render
b. It let us change the vertices freely
c. It helps if you are thinking on using a “Visibility Algorithm” later on.

4. Clone the “collider1” Game Object and call it “collider2”.

5. Add a PolygonCollider2D component to both children.


6.  “collider1” will be the first half of pacman, and “collider2” wil be the second half.

7.  Use the keyboard keys to edit the PolygonCollider2D points and fit it with the image. (


8.  This is the most important step. To prevent artifacts on 2DLight mesh  the secret is to setup both colliders with only one contact point between them, see the image below:


The following animation shows the pac-man on the left side contains the collider automatically generated by unity and the pac-man on the right has the fragmented collider with only one point of contact.

Notice the difference when the Light fills the concave space.