The ultimate collision riddle

here’s a hard one. as you can see in the upper half of the picture, i’ve successfully developed a way to resolve simple object <->  object collisions. i evaluate all possible translations along the x, y and z-axis and choose the smallest one on each axis that leads to the moveable objects not being inside the static one anymore, which works perfectly if there is only one static object.

but as you can see in the lower picture, i get an infinite loop if there a two of those objects having parallel walls. the moveable objects aka the player gets pushed from one wall into the other and back, and forth, and back, and…

i can easily detect these situations by checking if i get repeated translations, but i don’t know how to solve them. i mean, yes of course i know i should move the object to the bottom, but how to explain that to my computer?



You don't move the player at all… when the player attempts a move to a certain position, you check if that position is valid by temporarily moving the player then checking for collisions against the scene graph, if there are collisions you restore the position he was in the last frame (which is a valid position).

no, that would lead to a serious problem:





as shown in the picture, if the player runs along a wall, he would be glued to that wall, even if the angle between the wall and his movement is 0.00001 degrees. no FPS is doing it that way.

What you could do is simply make the objects act like a sponge… You don't avoid the contact, you just make it a force pushing objects away from its center of mass (assuming the objects is convex, like a box). This way you might have some more realistic behavior of running towards the wall and slowing down when getting close (I am still to find a person that moves around like players in a FPS, ramming at every wall  :smiley: )