Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

OnTriggerExit2D not firing when Kinematic Rigidbody Collider exits Trigger Collider

Discussion in '2D' started by anigmha, May 10, 2014.

  1. anigmha

    anigmha

    Joined:
    Feb 2, 2014
    Posts:
    3
    I have two objects:
    - Object1 has BoxCollider2D with isTrigger checked.
    - Object2 has BoxCollider2D with isTrigger unchecked and RigidBody2D with isKinematic checked.

    When Object2 exits Object1, why does Object1's OnTriggerExit2D not get called? According to the Collision Action Matrix below, OnTriggerExit2D should fire.

    $Untitled.png
     
  2. Pyrian

    Pyrian

    Joined:
    Mar 27, 2014
    Posts:
    301
    In my experience, without a non-kinematic rigidbody, triggers and collisions just don't fire in 2D, Collision Action Matrix notwithstanding.
     
  3. anigmha

    anigmha

    Joined:
    Feb 2, 2014
    Posts:
    3
    I see. So when it comes to 2D, the Collision Action Matrix is not accurate? Hmm, I wonder if this is a bug or just bad documentation (or maybe I did not read it properly).
     
  4. diegzumillo

    diegzumillo

    Joined:
    Jul 26, 2010
    Posts:
    418
    I'm pretty sure it's a bug, but don't take my word for it. Try testing the behavior of ontriggerstay2d too. From my knowledge this is a bug that has been fixed already but not in a public release.

    My new project is a 2d game but I'm not using 2d physics for now. It's all too new and a bit rough around the edges :)
     
  5. Bivrost

    Bivrost

    Joined:
    Mar 26, 2014
    Posts:
    80
    It is by design that a 2D kinematic rigidbody does not fire an OnTriggerEnter/Stay/Exit2D event.

    Link: Issue Tracker
     
  6. anigmha

    anigmha

    Joined:
    Feb 2, 2014
    Posts:
    3
    Thanks! Not the answer I was hoping for but at least now I know the current status of the issue. If it is really "by design", someone should probably update the documentation then.
     
  7. diegzumillo

    diegzumillo

    Joined:
    Jul 26, 2010
    Posts:
    418
    Is that status confirmed by a dev? I'm skeptic.
     
  8. Bivrost

    Bivrost

    Joined:
    Mar 26, 2014
    Posts:
    80
  9. diegzumillo

    diegzumillo

    Joined:
    Jul 26, 2010
    Posts:
    418
    You're right! well that's a bummer. But I know there is a bug with these trigger functions that is not by design, where they fire erratically. I was thinking of these bugs.