Search Unity

Setting rigidbodies to ignore raycasts makes them ignore triggers too

Discussion in '2D' started by Murgilod, Feb 8, 2016.

  1. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,162
    As the title suggests, I'm having a problem where if I have a rigidbody2d set to ignore raycasts, it passes through triggers without, well, triggering them.

    In order to keep bullets from colliding with my player as they shoot, I have my bullets set to ignore raycasts. Unfortunately, doing so causes them to pass through triggers without a care in the world, when in fact they should be being destroyed. If I change the layer from Ignore Raycasts it works, but then my player is pushed around by bullets, which is something I don't want to happen. Is there a way around this?
     
  2. vakabaka

    vakabaka

    Joined:
    Jul 21, 2014
    Posts:
    1,153
    set different layers for player and bullets. Then go to: setting-project settings-2d physic and disable collision in physic matrix for those layers
     
    theANMATOR2b likes this.
  3. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,162
    That did the trick, thanks!