Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Two edge colliders not colliding with each other?

Discussion in '2D' started by Togglesworlh, Aug 12, 2014.

  1. Togglesworlh

    Togglesworlh

    Joined:
    Nov 12, 2013
    Posts:
    40
    I'm not sure if this is intentional, or if it's a bug, so here we go!

    They're both on the default layer, and the default layer is set to interact with itself in the physics layer settings. The edge colliders will collide with box colliders, circle colliders, and polygon colliders. But not other edge colliders. Neither are triggers. They're both the base object, so no weird parent-child relationship trickery. I've tried a number of variations of numbers of vertices and simple shapes constructed using a single edge collider.

    The most basic experiment I've set up is one object without a rigidbody2D (so, a static edge collider), and one object with a rigidbody2D (situation above the first). Gravity should force the first to fall into the first, and the first to catch the second. Instead, the second just falls right through and beyond, without even reacting.

    It would make sense for edge colliders to maybe not necessarily be expected to collide with each other, as they could have been designed with the intent to only ever be static, level geometry, but that's not how I ended up using them, so I'm hoping this is just a weird bug, a solvable problem!
     
    ASLD likes this.
  2. Pyrian

    Pyrian

    Joined:
    Mar 27, 2014
    Posts:
    301
    Having no depth, it's very easy for edge colliders to pass through each other in a single step without intersecting.
     
  3. Togglesworlh

    Togglesworlh

    Joined:
    Nov 12, 2013
    Posts:
    40
    If that were the case, using continuous collision detection should fix the problem. It doesn't. Also these objects are not moving fast. I have them moving very slowly. I don't think that's the problem.
     
  4. Togglesworlh

    Togglesworlh

    Joined:
    Nov 12, 2013
    Posts:
    40
    Well, based on this four-year-old thread on the Box2D forums, I guess it was never an intended feature that edge colliders collide with each other.

    http://www.box2d.org/forum/viewtopic.php?f=3&t=5918

    I guess my theory that edge colliders were only designed to be static is true.
     
  5. kpetkov

    kpetkov

    Joined:
    Mar 3, 2018
    Posts:
    12
    Hi Togglesworlh, I have the same issue with edge colliders, they don't like to interact with other edge collider, but interract really well with polygons, box, circle, capsule etc. I use them as static as you said they work really good. For my purposes I replaced them with box collider or polygon collider depending on the case if I need some rectangular or non rectangular form.
     
  6. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    This thread is quite old :) I know when people start here, they aren't used to looking at the dates. heh.
    That user also hasn't been seen in almost 3 years.
     
  7. Absoluteone

    Absoluteone

    Joined:
    Jul 29, 2020
    Posts:
    1
    It's July 2021 now, Edge colliders still don't detect each other. Don't know if it's intentional or a bug
     
  8. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,414
    We all know the date so I'm wondering why it's relevant? ;) Did someone say it was being added somewhere?

    A bug that's been here since 2014? The physics engine (Box2D) doesn't support edge/edge collisions.

    The notion of infinitely thin edges, forming an open region, colliding with each other and being stable isn't realistic to be honest. Whilst we could support that when there's an edge radius, at that point it becomes a capsule/capsule collision.

    Take a look at the EdgeCollider2D scene in my PhysicsExamples to see this (drag them around) here.