Search Unity

Physics2D.IgnoreCollision problem

Discussion in 'Physics' started by llamagod, Oct 28, 2016.

  1. llamagod

    llamagod

    Joined:
    Sep 27, 2015
    Posts:
    76
    In my game I want the player and enemies to interact with the environment (stand on ground and stuff), but I want the player to be able to go through the enemies. If I use Physics2D.IgnoreCollision between the colliders the player can go through the enemies, but there is no way to check if the colliders are overlapping which I need for stuff like touching damage. Even Collider2D.IsTouching doesn't work (makes sense since it just retrieves last collision results based on the performance).

    I've concluded that there are two ways to do this:
    Have twice the colliders (an extra trigger collider)
    Manually check collisions yourself.

    Am I missing something obvious?