Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Rolling Ball Bounces On Mesh Edges

Discussion in 'Entity Component System' started by mpforce1, Oct 24, 2019.

  1. mpforce1

    mpforce1

    Joined:
    Apr 4, 2014
    Posts:
    34
    When using the ECS Physics Package, a ball rolling on a mesh will bounce or slow when passing over an edge within the mesh. I have previously asked Unity support about this issue and they said that it was a result of the collision detection method used in the new physics package. They went on to mention that this can be fixed by using ModifyNarrowPhaseContacts from https://github.com/Unity-Technologi...Scripts/ModifyNarrowphaseContactsBehaviour.cs However, this system only works in the case that friction is set to 0 and it also causes balls to not slow down when travelling up a sloped surface.

    It was also suggested that I should try to use a single flat plane collider when possible but, at least in this case, that isn't viable. Additionally, I would like to be able to roll the ball over curved or otherwise complex surfaces which wouldn't really work with that idea.

    Ideally there should be a way to stop balls from being affected like this by edges inside of a mesh. My guess is that I should be doing something to the contact data, something different than what's in the ModifyNarrophaseContactsSystem but I don't know what that should be.

    This video shows the issue as best as I could record it. The ball is moving over a single (mostly) flat mesh which has been split up into many faces. Whenever it passes over an edge the ball jumps or is slowed. I should note that the ball is constrained by some invisible walls but this problem persists with those removed.

    Unity Version: 2019.3.0.b7
    Physics Package Version: 0.2.4

     
  2. mpforce1

    mpforce1

    Joined:
    Apr 4, 2014
    Posts:
    34