Search Unity

Enable collision between 2 colliders while collision disabled in Matrix

Discussion in 'Physics' started by Unityraptor81, May 20, 2021.

  1. Unityraptor81

    Unityraptor81

    Joined:
    Nov 28, 2016
    Posts:
    29
    Hey all,

    is there a way to enable collision between 2 colliders on separated layers which are set to not collide in collision matrix like :

    - collider A is on layer 1
    - collider B is on layer 2
    - Layer 1 & Layer 2 are not colliding

    --> if i set physics.ignorecollision(A,B, true), collisions won't occur and i want them to occur for these specific colliders.

    Because, on the other side, if layers are set to collide in matrix, i can disable collision between A & B with physic.ignorecollision. I was wondering if it was possible the other way

    thanks a lot for your help

    Jay / Tales of Glory dev
     
  2. arfish

    arfish

    Joined:
    Jan 28, 2017
    Posts:
    782
    Isn't it a 3:rd layer you want for this?
     
  3. Unityraptor81

    Unityraptor81

    Joined:
    Nov 28, 2016
    Posts:
    29
    It could work if i had to do this only for a set of colliders but i have to handle this for many many colliders pair

    What i would like to achieve is a default behavior where colliders don't collide (achieved through layer matrix) and be able to overide the default behavior for specific pairs of colliders (but too many to use dedicated layers)