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. MelvMay

    Jan 17, 2014 15:05

    Isn't the title incorrect? It should say Kinematic colliders don't interact with static colliders. By not adding a rigid-body to "the other cube" it is static. That is "by design" because this is what Box2D imposes. Kinematic only interact with Dynamic.

    Regardless, I have recently implemented a change internal to Box2D to allow Kinematic bodies to interact with Static bodies.

  2. KaKaGo

    Jan 17, 2014 09:12

    Different from 3D.
    Document do not tell the difference.
    Bad Design.

  3. SpaceMidget75

    Jan 15, 2014 13:28

    Agree this shouldn't be by design unless Unity can explain why it behaves differently to the 3D behaviour.

  4. PiecesOfLogic

    Jan 11, 2014 19:46

    I posted this in feedback: http://feedback.unity3d.com/suggestions/2d-kinematic-rigidbodies-must-cause-ontrigger-events

    Agreed. This is a huge design flaw that needs to be fixed ASAP.

  5. JonBPS

    Jan 10, 2014 10:57

    This should be fixed, no idea why this is By Design.

    The inconstancy between 2D physics and 3D physics is bad.

  6. jellybit

    Dec 25, 2013 05:07

    Very confused as to why this is by design. Just try to make a few 2D games and this design choice seems more and more mind-bendingly ridiculous.

  7. GustavoCarvalho

    Dec 21, 2013 19:53

    Agreed. Make perfect sense kinematics (like a moving platform) to trigger colliders.

  8. littlepolygon

    Dec 17, 2013 02:51

    @TAK "Kinematic can collide with kinematic. " - this is inaccurate.

  9. littlepolygon

    Dec 17, 2013 02:46

    By Design = Bad Design!

    Kinematic bodies are extremely common for character control. Without triggers, that whole paradigm is bricked.

  10. Tak

    Dec 10, 2013 16:41

    More information:
    "In Box2D kinematic bodies only collide with other kinematic bodies, therefore the second static body doesn't create a contact.

    When you change the first body to be dynamic (un-check the IsKinematic property), then it's a dynamic body. Dynamic bodies do collide with static bodies.

    Kinematic can collide with kinematic.
    Dynamic can collide with static and dynamic.
    Static can collide with dynamic.

    Box2D imposes this and not Unity."

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.