I have a rigidbody based character which is a capsule object, and several trigger colliders in the scene. In the on trigger enter event, I’d like to get the point in which the character initially entered the trigger collider. What would be the best and most accurate method to do this?
Looks like you want a point on the edge of that polygon that intersects the center-line of the capsule. This is a pretty arbitrary point and isn’t special to anything in Unity so you’ll need to calculate it yourself.
Even if you ask the physics system based upon colliders, that point isn’t going to be returned because it has no reason to calculate it.
If you have the lines of the polygon and the details of the capsule then you can calculate the intersection yourself.
Maybe you don’t want that specific point but something else?
2D Physics provides a call of Physics2D.Distance (also Collider2D.Distance & Rigidbody2D.Distance) that returns a ColliderDistance2D struct containing distance between nearest points and also contains points that reference both colliders. These points are where the physic system would apply forces if they’re overlapped (not used if they’re separated) so they won’t be guaranteed to be that point you specified in your image but in a lot of cases, when only just overlapping they’ll be similar.
Anyway, it might serve your purpose.
