Search Unity

Will Unity discard distant parts of a (2d) Polygon collider in the broad phase?

Discussion in 'Physics' started by unity_HUNB7qVfwARzMQ, May 6, 2019.

  1. unity_HUNB7qVfwARzMQ

    unity_HUNB7qVfwARzMQ

    Joined:
    May 6, 2019
    Posts:
    2
    Hello,

    I am wondering about the usage of the Polygon2D Collider. In essence, is there any merit in splitting up a large 2D polygon collider into several parts, as illustrated in the sketch below (black triangles are the polygons, orange ball is size of a typical moving object). The idea would of course be that distant colliders can be discarded early in the collision phase. Or will Unity do something like this anyway on the level of individual polygons/edges in a single large collider?
    upload_2019-5-6_1-35-43.png
    Thanks in advance for your comments!
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,500
    The underlying physics system knows nothing about the PolygonCollider2D. It only knows about convex primitives so in your diagram, the triangles are polygon primitives so each has its own entry in the broadphase so what you're suggesting already happens.
     
  3. unity_HUNB7qVfwARzMQ

    unity_HUNB7qVfwARzMQ

    Joined:
    May 6, 2019
    Posts:
    2
    Thank you for your fast reply, that's good to know.