Find overlapping colliders after instantiation

Hello,

I try to use OnTriggerEnter for colliders I instantiate. They don’t move, I just want to see if they overlap.
I searched a lot and tried many things. Moving them a tiny bit after instantiation, disable/enable them. I also tried OnTriggerStay. It works sometimes but mostly not…
I can’t use OverlapSphere because it must take the shape into account exactly.

Both elements have “IsTrigger” enabled and also have a kinematic RidigBody component attached. It works, when I move them around manually in the editor after instantiation but other than that, OnTriggerEnter/Stay is never called.

Are there any other possiblities?
I use Unity 2020.3.20f1.

Thanks a lot

How/When are you instantiating those objects? Could you share more details (objects, code, etc)?

Based on that description, It should work. Making one of those triggers a kinematic rigidbody should be enough.
See Kinematic Rigidbody Trigger Collider vs Static Trigger Collider and Kinematic Rigidbody Trigger vs Kinematic Rigidbody Trigger)

I assume that “both” elements are A) the one you instantiated, and B) an object that already exists in the scene(?).

Actually both elements are B)
It’s a very simple setup. The user can choose objects from a constuction kit and places them next to each other. They never move. I just want to make sure they don’t overlap.
Some of them have primitive colliders, some have a mesh collider (convex).
And as I said, when I move them a little bit (don’t even have to separate them completely), OnTriggerEnter is called.

I solved it by using Physics.ComputePenetration: Unity - Scripting API: Physics.ComputePenetration
Didn’t know about this, it works very accurate.