How to best use ComputePenetration?

I’ve been experimenting with a custom physics loops using a kinematic rigidbody and MovePosition / Rotation. However I’m struggling to get good results using ComputePenetration - is there a trick to using it?

For example, if I use a trigger collider as my ‘collider’ and use ComputePenetration in OnTriggerEnter, the player very often tunnels through the other collider. Do I need to be checking a wider area around the collider maybe?

And my other question is, how do you deal with mutltiple colliders, e.g. if my character goes into a tight corner which is two separate colliders?

Any advice gratefully received!

Just query for overlap like in the example in either Update or FixedUpdate and resolve the overlaps with ComputePenetration. I find it’s best used as a backup to ensure you don’t sink through geometry as well as automatically take care of a few edge-cases and instead sweep the character shape in the move direction as a main way of dealing with collisions. If you move it by transform you might want to enable “auto sync transforms” or call Physics.SyncTransform() after translation, else it might look a bit choppy.

The issue of walking into a crevice consisting of multiple geometries isn’t handled very well by ComputePenetration because you’re dealing with multiple translation vectors and 1 overlap resolution might push you inside another shape and so on / so forth until everything’s been resolved and might look a bit choppy too. A possible solution is to gather all relevant contact normals and calculate a single direction & distance that will resolve all overlaps but that’s overly complex i think, it’s easier to sweep.

Ah OK - yep sweeping might be the ingredient I was missing! Thanks @EnokV