Physics: Collision resolution fails and is not robust #575
Labels
area: simulation
Things related to what can happen in the world as time progresses.
kind: bug
Something isn't working as it should
We currently define body collision in terms of
self.collision_box
translated byself.position
. The problem with this definition is that rounding error means that it is difficult for collision detection to achieve the specific absolute positions of the box's faces that definitely don’t collide with any block, because after picking a value forself.position
, the resulting translated collision box then hasrounding error.
nudge_on_ray()
tries to fix this during collision resolution, but doesn’t succeed sometimes.I think we can solve this problem by defining a collision box in absolute coordinates, which can be computed sometimes-exactly to
ensure they land on the correct side of surfaces collided with. As a brute-force strategy, we can always slightly squish the box to
compensate for rounding errors that lead to intersection. Then, by also keeping the original relative-coordinate collision box, we can restore the intended shape when no collision occurs.
Commit 8b74029 implements the first part of this, by adding the absolute collision box (named
occupying
). However, I still need to actually make it used in this way; right now it is only written, not read.Blocking #272.
The text was updated successfully, but these errors were encountered: