New vs Old
Not much progress has been made. The behaviour only got worse instead of better. This was after I found a mistake. But yeah, it didn’t help at all… Other changes also didn’t improve things much.
I’m thinking now of setting back the old code. That worked far better than what I have now. One of the possibly reasons for that is that I actually used the wall normal. The wall normal was used there to correctly determine the direction the entity should be moved in. As well as the direction of the new velocity of the entity.
I’m not sure if this new code can easily pass that wall normal back and therefore do the same thing or not. Of course the old code would need to be cleaned up heavily. However this can for a large part be done with parts of the new code. Especially the shape generation is quite large and could be replaced with a lookup in the future. But also with a couple function calls to the new code. I hope that setting back the old code and cleaning it up will help me understand the differences between old and new. So that I can find other mistakes I made.
I also thought of a different way of detecting if a collision has happened. But I dont think you can easily get the overlap with that method. So how far one shape has collided into another. It will only tell you if it collided through a somewhat fast calculation I think. Maybe I will test that method someday to see if it actually works. As I have never actually heard of doing collision detection this way. But I won’t use it in this game. It would probably only make things worse haha.