Objects getting stuck between collision triangle edges in 2D

Godot Version

4.4.1

Question

I have a 2D game in which round objects move at maximum speeds of 15000-20000 pixels per second. Everything otherwise works just fine, but when the objects collide near collision polygon triangle edges (or near vertices, I’m not sure), they will occasionally move to between the triangle edges and get stuck there. Also, the objects can sometimes move along the edge between triangles, as if there was open space there (sort of like colliding with one triangle, getting pushed back, colliding again and so on).

I’m using RigidBodies. I have switched the Continuous CD to Cast Shape. I have switched the max allowed penetration in project settings to 0.001. I have tried increasing the solver iterations to 100. I have made the objects bigger. I have no idea if any of these work, but haven’t seen any visible results.

I’m using the SmartShape2D addon to make my shapes, but as far as I can see, it makes a CollisionPolygon just as there always would be.

Any ideas or anyone have experience with this?

To me it looks like internally the collision polygons are divided into triangles, and there is space between them, which sounds like a bug. Also, I think sometimes even a few hundred pixels per second is enough to trigger this. I would completely understand if 20000+ px/s was sort of unacceptable, but.

If the problem itself cannot be resolved, then how would I go about gracefully getting the objects out of the collision polygons, once in there?