Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Use PolygonCollider2D for flat surfaces

Discussion in 'Editor & General Support' started by Dustin27, Aug 14, 2019.

  1. Dustin27

    Dustin27

    Joined:
    Nov 12, 2018
    Posts:
    5
    Hi,

    I got an flat surface described by a list of points. I want to give that surface a collider.

    Adding a PolygonCollider2D with these points causes the collider to be rotated 90 degrees.
    PolygonCollider2DFlipped.PNG
    I am also not able to rotate the collider through rotating the game object, because the collider just gets smaller but does not rotate.
    PolygonCollider2DFlipped2.PNG

    Is there a way to use polygon collider for my case?

    Kind regards
     
  2. MSplitz-PsychoK

    MSplitz-PsychoK

    Joined:
    May 16, 2015
    Posts:
    1,278
    Unfortunately 2D colliders can only stretch in the X and Y directions and does not have Z coordinates. As you've already seen, this means you cannot rotate a 2D collider so that it's points move on the Z axis.

    If you're making a 2D game and want to use 2D colliders, you will need to design the game to be viewed forward down the Z axis, and not from above down the Y axis.

    If you're making a 3D game, you need to use 3D colliders. 2D and 3D colliders do not interact, and will not trigger/move each other. You cannot make 3D physics involving 2D colliders.
     
    Dustin27 likes this.
unityunity