Collider2D.GetContacts(List() contacts) works with OnColliderEnter2D but not with OnTriggerEnter2D

I need to know the point of contact when two objects Collide, but I want them to pass through each other. I originally tried:

    private void OnCollisionEnter2D(Collision2D collision)
    {
        Debug.Log("Collided");
        List<ContactPoint2D> contacts = new List<ContactPoint2D>();
        int numContacts = collision.GetContacts(contacts);
        Debug.Log(numContacts);
    }

The program would then write “Collided” and “1” to the console when the players bumped into each other but didn’t allow for them to pass through each other.

Then I switched on the “IsTrigger” value on my player and tried again with the following code:

    private void OnTriggerEnter2D(Collider2D collision)
    {
        Debug.Log("Trigger");
        List<ContactPoint2D> contacts = new List<ContactPoint2D>();
        int numContacts = collision.GetContacts(contacts);
        Debug.Log(numContacts);
    }

The program would then write “Trigger” and “0” to the console when the players bumped into each other but did allow for them to pass through each other

Does the OnTriggerEnter2D() function not track the ContactPoint2Ds? Is it because OnTriggerEnter2D has an input of Collider2D and not Collision2D?

Does anyone know why this is happening? Thanks!

Unfortunately OnTrigger methods don’t get contact information. The workaround is to instead have the trigger object in question use a kinematic rigidbody and set isTrigger to false.