In some cases applying the minimum translation to two colliding objects does not cause them to no longer collide. The result is that two objects can end up colliding twice in the same frame. It appears this is due to a floating-point precision problem after dividing the minimum translation distance by 2 and applying it to both objects.
Here's an example of it happening where I added some logging to the collision system and my own movement system.
tick 184
CollisionSystem updating
entityAABB={{30.498873 70.972755} {50.49887 90.972755}}, otherAABB={{24.168776 52.105198} {44.168777 72.105194}}, mtd={0 1.1324387}
collision: ball1=29, ball2=6
collision: ball1=6, ball2=29
entityAABB={{24.168776 51.53898} {44.168777 71.53898}}, otherAABB={{30.498873 71.53897} {50.49887 91.53897}}, mtd={0 -7.6293945e-06}
collision: ball1=6, ball2=29
collision: ball1=29, ball2=6
As you can see both of these collisions happened in the same tick. You can also see the minimum translation was applied by the Y-coordinates are just SLIGHTLY overlapping which you can see by looking at the Y-coordinates and the mtd value in the 2nd collision.
I propose we should either always apply a small delta to the mtd or we need to check whether applying the mtd will still cause an overlap and then apply a small delta.
In some cases applying the minimum translation to two colliding objects does not cause them to no longer collide. The result is that two objects can end up colliding twice in the same frame. It appears this is due to a floating-point precision problem after dividing the minimum translation distance by 2 and applying it to both objects.
Here's an example of it happening where I added some logging to the collision system and my own movement system.
As you can see both of these collisions happened in the same tick. You can also see the minimum translation was applied by the Y-coordinates are just SLIGHTLY overlapping which you can see by looking at the Y-coordinates and the
mtdvalue in the 2nd collision.I propose we should either always apply a small delta to the
mtdor we need to check whether applying themtdwill still cause an overlap and then apply a small delta.