I guess we finally came to the resolving part of the collision detection. Or the physics system rather, as it really needs to play well together. However I again was not successful in getting stuff to work properly. I’m really tired of trying this stuff, so sorry if this devlog is a mess.

But basically what I did is, start on the original idea. So continuing on from the past days. Trying to get the right collision and based on that move the entity a certain amount forward. Which seemed to go fairly well. It was at least stopping on a collision. Visually it looked correct to me.

The collider was never penetrating further into the collider of the tile. However the entity would not be able to move once a collision occurred. Since rotating the entity would be needed to get it out of its situation, but that also made it penetrate the collider… But it also didn’t keep its momentum when hitting a diagonal wall. That made me simply go the "easy" route instead.

Plan B
I say the easy route, but it’s far from easy as it turns out. So my backup plan this time was to simply let the collision happen. Once a collision occurs, we know exactly with how much it penetrated. We can move the entity out of the tile and negate the velocity in the direction of the tile we just hit. Hopefully that sounds simply. But I guess it isn’t so simple to implement after all. Though it probably is, I’m just doing it incorrectly probably.

The problem with this system currently is that it moves the entity too far out. But whatever I tried I couldn’t get it right. However the direction seems to also be wrong. Which is a bit remarkable to me. I guess the code returns the wrong collision. Even though I already check for the collision that contributes the most for the direction of travel.

What To Do?
I’m not sure if I should give the original system some more time. As that basically works solid, but a bit too solid. And there could very well be a lot of edge cases again that I haven’t tried out yet. But on the other hand, the "easier" plan B is not working out as well… However since it seems to only be the incorrect value that I move the entity with. Even if it’s in the incorrect direction. That system has more change of succeeding for now. And I really need to get going with other stuff again. So I think I will try to debug plan B and hopefully have a good enough system up and running at the end of the week. Which means it would still not be final, but I really need something at this point.

Last modified: July 17, 2023