I think today some good progress has been made. The important bits were discovered yesterday. But today I noticed some garbage code that I could clean up. It was all about the tile region.
That region determines what tiles get checked. There lies the problem as found yesterday. Though yesterday I actually had a small typo which I somehow didn’t see in the compile log. Therefore I thought the fix didn’t do anything, but it did. However changing that fix to how the code should actually be to be a proper fix, it only worked half the time. So there was still something wrong.
Where Is My Debug View?
The fix should be to correctly add in the delta movement. I was doing that in a wrong way in the old code. Besides that I now also add in the new rotation.
This all works if you take the squared length of the delta movement. But not if you take just the length itself. Remember that it only determines which tiles get checked. It isn’t used any other way. So if the value ends up at just the edge between two tiles, then it should take both into account. Maybe that’s where it goes wrong currently? But other than that I would expect it to work. Which means more debugging for me.
I do hope that this cleaned up code was the piece I was missing for rotation. As basically tiles that were getting overlapped if the rotation was applied would not even get checked. Because they would not be in the tile region. Just a stupid oversight of me. But a very important detail to include of course.
And since apparently just having a rotation together with a velocity can already break things. Continuous rotation together with an incorrect tile region then quickly breaks even more… I’m getting hopeful again