We've got a character setup based around manually resolving collisions, and we're using bullet to do so. Our characters have a kinematic rigidbody to push things around, but their movement and positioning is done using a separate (pair caching) ghost object. Every physics tick we iterate over all contacts for that ghost and resolve collision either by depenetrating 100% when it's ground, or by depenetrating gradually/not at all with walls or other characters. We then apply our ghost's new position to the kinematic rigidbody so that can interact with other physics objects.

Unfortunately, when moving around a flat world made up of a bunch of coplanar blocks, when the characters moves from one block to another it will often do one of two things;

  • Fall through the cracks
  • Get bumped upward a significant distance (we're talking up to half a unit/meter with a character that is 2 units/meters tall)

enter image description here

Debugging this tells me sometimes these contact points are unexpected, and not something I want to resolve by depenetrating 100%. Gravity moving the character downward can result in a contact point that is closer to the side of the terrain block than the top, and it will give you a normal/distance accordingly (blue arrow). Resolving that with 100% depenetration will just push you in between the blocks, while not counteracting the gravity forces. This would explain the falling through the cracks. But I don't know why I sometimes get contact points with normals pointing straight up, but with a distance that would place the collider far above the ground (purple arrow).

I've come to the point where I feel like my only option to handle character movement like this is by not colliding with the ground at all, and just spherecast downwards at the character's position on the horizontal plane just to place it down on the ground properly.

Now obviously I want to get rid of this behaviour. And seeing how you don't see this happen in many games, I'm lead to believe others have solved this issue somehow. Has anyone here encountered similar issues, and how did you go about fixing them?

  • \$\begingroup\$ Bennett Foddy talks about this type of edge issue in this physics session from GDC \$\endgroup\$
    – DMGregory
    Apr 4, 2019 at 9:24
  • \$\begingroup\$ After watching that talk I tried CCD, but that does not appear to work. Likely because we're manually resolving collision. And placing a ton of extra colliders everywhere just to avoid falling in between the cracks seems like a suboptimal solution when we're already solving things manually. \$\endgroup\$
    – Mick Derks
    Apr 4, 2019 at 10:15


You must log in to answer this question.