I’m trying to use the newly exposed ComputePenetration function in Unity 5.6.0b9. It seems to work as expected when the involved colliders are centered on the game object’s origin, but I’m getting strange results when testing with colliders that are not centered in their object’s origin when the object has a rotation and a scale.
The image below shows one of the situations where Physics.ComputePenetration doesn’t seem to work. The yellow line shows the depenetration direction using the center of the collider and the red line shows the depenetration direction using the transform position of the collider (as shown in the Unity Docs).
Find the whole setup in a Unity Package [89850-computepenetrationtest.zip|89850].