I have a question about how “Physics.IngoreCollision” is supposed to work.
Assuming we have two colliders on different GO with same layer, which is set to not collide with itself in Collision Matrix, are we supposed to overwrite this behavior with Physics.IngoreCollision (collider1, collider2, false) ?
In my tests this does not seem to work, collisions are still ignored after doing the above call for each collider pair.
Is there another way to achieve this? the 32 layers are not sufficient in my case to express all collision behaviors.
You can consider using the new contact modification API then you get unlimited interactions as you decide to ignore the collision or not inside a callback before any collision response actually occurs (assuming you ever needed limitless control).
Honestly though, very rare for a real game set up correctly, to need more than a handful of layers, you would want to use layers as an optimisation, then have more fine-grained reasoning for a better way to work with physics in Unity.
Using them en masse (running out of layers) for gameplay is not the right way to go about it.
depends on the use case This is for complex characters, simulating finger joins (articulation bodies) and other body parts in full detail. if we keep full collision between the body parts, joints cannot do full movement anymore, so the setup needs to be quite complex. Contact Modification is indeed a good idea, and something we already use to overcome the restrictions of convex colliders. Thanks for the idea!
This could also be an option, albeit a lot of configuration work, as the exclusions would be a lot. The other way around would be way easier, but seems that unity does not offer this option.
the script would still need to be configured with all exclusions for e.g. individual finger joints. This script is already there for the vice versa case, I just need to turn it around.
But thanks for the help! Wanted to get sure that there is no other / easier way.