Search Unity

Physics Issue w 2D colliders. Incorrect Collision2D.contact.points

Discussion in '2D' started by blaher, Oct 30, 2014.

  1. blaher

    blaher

    Joined:
    Oct 21, 2013
    Posts:
    80
    I am trying to understand what is going on with my 2D colliders. I am seeing incorrect collision points OnCollisionEnter. I slowed down time so I could better see exactly what is happening and it fixed the issue. At first I thought it was just fast moving objects but if that was the case I think I should be seeing the opposite of the issue. The collision points are IN FRONT of the object being collided with, not further within.

    Fullspeed videos of the bug and slow motion:

    BUG@normalspeed:
    FIXED w Slowmotion:

    Normal speed showing the bug (the green glows are centered on collision points. Notice the one floating in space in to the side of the nose?):

    Editor view, the white boxes are the centerpoints of detected collisions. Notice they are all off a bit:



    To debug, I slowed down Time.timescale and Time.fixedDeltaTime and it completely fixes the issue, but of course I don't want to have to slow motion all collisions in the game to have correct physics:

    Editorview of slowmotion, notice the collision points are perfectly on the edges of the objects:


    As you can see in the video capture the objects are not really moving very fast either so I don't think that is the issue. One thing I can see when pausing quickly at normal time but I can't seem to capture on video is that for a split second the energy weapon fx's collider is well on top of the ship, then the ship snaps to a new position from collision impact and THEN the OnCollisionEnter is called, so the points look like they may have been correct if the ship hadn't reacted to the physics BEFORE the OnCollisionEnter was called.