Search Issue Tracker

By Design

Votes

24

Found in

4.3.0f4

Issue ID

575251

Regression

No

Rigidbody2d with kinematic rigidbody will not cause OnTriggerEnter2d

Physics2D

-

To reproduce:
1. Create two 2D cubes with colliders 2d
2. Attach a rigidbody 2D to one of the cubes and make the other cube a trigger
3. Attach a script with OnTiggerEnter2D (and some kind of debug message) to the rigidbody cube
4. Enter play mode and move the cube into the other cube - the debug message should get printed
5. Change the rigidbody 2d to kinematic - the debug message is no longer printed, OnTriggerEnter2d is no longer being called

Explanation: kinematic bodies (specifically colliders attached to those bodies) only collide with dynamic bodies.

The allowed collisions for body types are therefore:
Kinematic can collide with Dynamic
Dynamic can collide with Static, Dynamic & Kinematic
Static can collide with Dynamic

Comments (44)

  1. Saxi

    May 09, 2014 15:08

    By design? it should match the 3D functionality and be consistent.

  2. Rafes

    May 05, 2014 04:26

    Note. Use at your own risk: With gravity at 0 and the collider set to trigger, it seems to work as I need it to (someone else here mentioned this might work). This may not be a great solution but since I am not moving the object directly (moved by parent) I think it is OK. In the 3D system you should never move a non-kinematic rigidbody using the transform. I have no idea if that is true here. I'm not even sure why it moves with its parent instead of being left behind, but it moves....

  3. Rafes

    May 05, 2014 04:23

    We publish a product on the assetstore and I was spending my time extending it to the new 2D physics system. This is a blocking issue. It works in 3D physics but not 2D physics. Please fix it.

    Change the design if this is by design. It is obviously not correct for Unity as a whole to have this inconsistency.

  4. Rafes

    May 05, 2014 04:20

    We publish a product on the assetstore and I was spending my time extending it to the new 2D physics system. This is a blocking issue. It works in 3D physics but not 2D physics. Please fix it.

    Change the design if this is by design. It is obviously not correct for Unity as a whole to have this inconsistency.

  5. maros

    Apr 15, 2014 17:09

    Well, whether by design or not, the documentation (https://docs.unity3d.com/Documentation/Manual/Physics.html) states: "With trigger collisions, this restriction doesn't apply and so both kinematic and non-kinematic Rigidbodies will prompt a call to OnTriggerEnter when they enter a trigger collider."

    Please update the documentation.

  6. sun_spider

    Mar 29, 2014 22:24

    There has to be a way to detect 2d collisions WITHOUT physics effects. Please fix. I'm stuck bad.

  7. SrBilyon

    Mar 23, 2014 06:19

    Well, I was pretty sure at first that this was a bug, as I've spend two hours trying to figure out why kinematic rigidbody would never called OnTriggerExit2D. Now I know. This is a bummer that this is by design.

  8. Finch07

    Mar 21, 2014 15:10

    This is an incredibly annoying issue, not sure how this can be by design.

  9. Missile_

    Mar 09, 2014 20:23

    hey guys ! have you tried cancel gravity (Gravity Scale = 0 instead of 1) in rigidbody components? This made my triggers2D work perfectly now. Hope this will help you :-)

  10. Aliyerki

    Mar 04, 2014 21:54

    I canĀ“t work anymore, fix the bug....please

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.