Search Unity

Bug Unnecessary Collisions created at collider edges (results in bodies "jumping")

Discussion in 'Physics for ECS' started by zardini123, Feb 29, 2020.

  1. zardini123

    zardini123

    Joined:
    Jan 5, 2013
    Posts:
    68
    I have two moving spheres, each starting with an initial velocity of 50 m/s in the X direction. They both start just above their respective floors, therefore not starting with any upwards velocity. The sphere on the elevated platform is moving on a basic Box shape, whereas the sphere on the lower ground is moving on a Mesh shape with the default plane mesh associated with it.

    The ball sliding / rolling on the mesh jumps, whereas the one on the box doesn't Using Physics Debug Display and enabling "Draw Collider Edges", one can see that the jumping occurs at the "edges."



    Using "Draw Contacts" shows that the sphere jumps due to a contact/collision event happening at each edge. Notice the green arrow...



    This certainly doesn't seem like intended behavior, and seems like a byproduct of how collisions are handled. This is a bug right? If not, this certainly breaks the game I'm intending to make :p, so then how would I get around it, other than just removing planar triangles?
     
  2. Sima_Havok

    Sima_Havok

    Joined:
    Dec 16, 2019
    Posts:
    52
    The issue you described is expected issue of having speculative contacts for fast bodies. More about the issue you can find in this talk from the referenced time:

    So if ground has to be mesh there are 2 approaches that I see:
    • Try to implement customer contact modified like ModifyNormalsJob in UnityPhysicsSamples\Assets\Demos\5. Modify\Scripts\ModifyNarrowphaseContactsBehaviour.cs
    • Switch to Havok physics
     
  3. nathanAjacobs

    nathanAjacobs

    Joined:
    Feb 18, 2019
    Posts:
    9
    For anyone encountering this issue, try lowering the "Default Contact Offset" value in the Physics page of Project Settings. I was having this issue for days until I found some unreal forums talking about the same issue. I lowered the value from 0.01 to 0.001 and now I don't have any more ghost collisions.