2D collision detection minimum translation vector problem

I’m using Nez physics and I have a velocity variable that moves the characters every frame. In order to avoid moving into another collider, it applies the velocity to the colliders attached to the first character and checks if they intersect with any other colliders, if not it just moves. If there is an intersection at this new position it finds the minimum translation to apply to the first collider in order to move it away from the other and subtracts that from the motion.

The problem is that this minimum translation might move it away from one collider, but if it moved it straight into another it’s useless. The way this can happen is for example if the character is falling down at a high speed and falls down on some tiles, the distance it will move into the ground on the y-axis might exceed the distance it will take to move it to the next tile on the x-axis. How can I take the surrounding colliders into consideration?

1 Like

Hi, were you able to solve this problem?

It was 3 years ago so I don’t remember it so clearly. I can say generally the problem was most likely moving the character in 1 big step. Discrete collision detection gets buggy when travelling fast (see tunneling). A common solution is to split large movements into smaller steps and then checking for and resolving collisions between each step.

Thanks to answer! I find this link about plarform games: