Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Racast2D ignores Collider2D with IsTrigger = true

Discussion in '2D Experimental Preview' started by Habitablaba, Feb 20, 2017.

  1. Habitablaba

    Habitablaba

    Joined:
    Aug 5, 2013
    Posts:
    136
    I have an object with two Collider2D on it, the first is sized and offset to only cover the bottom half of my object. It has IsTrigger = false. I am casting a ray from my mouse cursor when I click. This properly finds the object if I click on the object where it is covered by this smaller collider.

    The second collider covers the entirety of the the object, and is set to IsTrigger = true. When I click on the object where it is covered only by this larger collider, the cast ray does not find the object. I've checked the physics and physics2d settings, and they both have Queries Hit Triggers checked.

    I've been able to work around this problem for now by creating a child object, moving it to a layer with no physics interactions, and making the collider not a trigger. While this is workable, it is obviously not ideal.
     
  2. Coffein

    Coffein

    Joined:
    Jan 22, 2016
    Posts:
    19
  3. Habitablaba

    Habitablaba

    Joined:
    Aug 5, 2013
    Posts:
    136
    Oops! Definitely thought I had that already, sorry everyone, nothing to see here