Search Unity

OnCollisionEnter2D fires late for Discrete detection only

Discussion in 'Physics' started by Peez-Machine, Mar 20, 2019.

  1. Peez-Machine

    Peez-Machine

    Joined:
    Jul 30, 2013
    Posts:
    27
    I've noticed when running some tests on kinematic Rigidbody2Ds that OnCollisionEnter2D is called a frame after the collision occurs when using Discrete collision detection. However, it's called on the correct frame for Continuous detection. Additionally, OnTriggerEnter2D is also called on the correct frame for discrete detection, so it's just the Discrete/OnCollisionEnter2D combo that fires a frame late. Is this intended? I know the late collision issue has been reported (and marked “won't fix” on PhysX grounds*) for 3D stuff, but I'm at least a little intrigued by the particulars here.

    This was with “Use Full Kinematic Contacts” and all movement done via MovePosition.

    *[question https://answers.unity.com/questions/938656/understanding-collisions-between-2-box-colliders.html and issue tracker https://issuetracker.unity3d.com/issues/collisions-are-detected-one-frame-later-than-they-occur ]