Interesting topic. I’ve met this issue when I was making an infinite scroller a while back. If you keep running forward, you can notice a slight camera bump when the player collider moves from one tile to the next.
I think this is also related to the issue that @Albertos has in his topic about crosshair problem. His ground is assembled from box colliders. The crosshair is always oriented to face the normal direction, but sometimes erratically turns on a seemingly flat ground.
Originally, I thought this might be due to the fact that the bullet engine adds a small margin to the box collision shape. As @kanet pointed, it is about 0.04. This rounds the corners of the box shape, so they are not sharp. If two boxes (rigidbodies with box shaped colliders) are placed right next to each other, then there should be a thin crevise on the edge. In theory.
What I’ve tried:
- I tried to change the margin of the box shapes to 0, to remove the presumable crevise. Unfortunately, it didn’t help. The ball still jumps off the edges.
- Then, I thought perhaps this is the way the engine calculates the box shape and having the height of the box as zero messes it up. Changing all sides to equal didn’t help. The result was the same.
- I’ve also tried to add a custom collision shape - a plane, which is not available through editor. I used
btBvhTriangleMeshShape
, which is good for custom static shapes. I basically created two triangles placed together, forming a square plane. Then used that plane to form a field of tiles, like in the original example of @AliMoe, placing field next to the one made from boxes. Unfortunately, that didn’t help either - the ball keeps jumping.