- Home /
Question by
tigertrussell · Feb 25, 2015 at 01:13 AM ·
2dcollider2dboxcollider2dphotoshoppolygoncollider2d
Force PolygonCollider2D into a Square or Autofit BoxCollider2D
Greetings,
I am trying to get a square Collider2D to fit closely around an irregularly-shaped Sprite surrounded by transparency on all sides (the Sprite in question is a single layer from a Photoshop file).
If I use a PolygonCollider2D, unity will fit the bounds of the Collider2D to be around the pixels that I want - this is awesome. However, I do not want the Collider2D to fit the object so closely - instead, I want just a regular 4-sided BoxCollider2D-styled collider.
Is it possible to have the BoxCollider2D class autofit in this same manner? Or to force the PolygonCollider2D to use at most 4 parallel, axis-aligned edges connecting 4 vertices?
Thanks in advance!
edited for precision
Comment
Your answer