Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Getting PolygonCollider2D convex segments?

Discussion in 'Physics' started by Eadgaras, Dec 18, 2018.

  1. Eadgaras

    Eadgaras

    Joined:
    Jan 27, 2014
    Posts:
    1
    Hi, does anyone know if it is possible to get the different segments (convex polygons) of the PolygonCollider2D? Thanks.

     
  2. steinbitglis

    steinbitglis

    Joined:
    Sep 22, 2011
    Posts:
    254
    I need this too
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,321
    This and much more landed in 2021.2 beta as mentioned here. Here's the API docs for the specific call you can use: Collider2D.GetShapes and Rigidbody2D.GetShapes.

    You can also now create your own colliders and do what the PolygonCollider2D/CompositeCollider2D etc can do.
     
    steinbitglis likes this.
  4. steinbitglis

    steinbitglis

    Joined:
    Sep 22, 2011
    Posts:
    254
    Excellent and quick answer! Best resurrected thread I ever saw :)
     
    MelvMay likes this.
  5. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,321
    Agreed! :) I'm eager to get feedback on the results of devs using this but am aware that this is only available in a beta right now but feel free to post back here with any questions or issues that might arise if you try it and I'll do my absolute best to help.

    Good luck.