Step Back
I think I managed to fix some bugs in the collision algorithm. Ignoring what some people said online and instead just stepping through the code. Observing what happens and what goes wrong and then fixing it that way. Just plain boxes are working now after realizing how the absolute value of the deltaMovement should be used in some cases. That gives me the correct values and therefore the algorithm works. I may still do it incorrectly and the algorithm may be designed better. But first it should just work and then I can look again why I have to use the absolute value.

I already do have an idea why though. However the important thing now is to get diagonals working. Which I know shouldn’t work since I am not using the correct normals. This is probably why the car stops and can’t move anymore. It removes the velocity in the wrong direction basically. So use the right normals and the car should be able to keep moving. At that point everything should work as intended. Which I would be very happy with, since it’s starting to become embarrassing that I haven’t fixed all these issues yet.

I managed to get the normals in the correct place and now the algorithm seems to work just fine. Some tiles were still not working, but then I found out that I was not rounding off the values that were important for the correct normals. So certain normals were pointing in the opposite direction. Fixing this fixed all the normals and the only thing left is to correctly set the normal for the first tile the tile editor finds. Because the first tile only has half the data it needs to correctly set its normal. I should simply go over that tile twice and then everything should be fine.

Last modified: November 9, 2022