Scaling PolygonCollider2D

Sometimes you want to select item on screen according to its graphical shape rather than a simple rectangular collider. In that case the best solution for that is Unity’s build in PolygonCollider2D component. Unfortunatelly for some images it could calculate shape that is too thin or too thick for our needs. I’m going to present how to scale calulated path according to vertices normal points that will give such effect:

scaling_result

Czytaj dalej