Search Unity

Which is faster, BoxCollider2D or EdgeCollider2D

Discussion in '2D' started by LostRelicGames, Jul 27, 2014.

  1. LostRelicGames

    LostRelicGames

    Joined:
    Aug 11, 2013
    Posts:
    34
    I have been unable to find a clear speed comparison between these two types of collision systems in 2D.

    The most basic 2D edge collider is 2 points. How does it compare against the 2D box collider?

    An edge collider can also have many points, how much does adding additional points effect the speed compared to the default 2 points?
     
  2. lrlelaldl

    lrlelaldl

    Joined:
    Jul 27, 2014
    Posts:
    75
    First and foremost do note that I have not done any tests, simply going on theory here, but I would assume the edge collider would be faster simply due to it being only 2 points. I would assume that they essentially use a ray cast for the edge collider, while using a lot more for the box collider; instinctively I'd assume that they put all the sprites on the same z level and treat it as a 3d object with a single face and use the 3D collisions of the set of sprites.
     
  3. Polys

    Polys

    Joined:
    Jul 13, 2014
    Posts:
    25
    I don't know what the performance is in unity but I know that Box 2D is well documented even with stress tests and examples. If you find the name of the function in Box 2D (the engine used for 2D physics in unity) you can probably find allot of general stress test information and pre built examples web page ready to test out with number of prims and such.