Coordinates
So what I found out today, what I should have found out yesterday, was that the tiles were rendering incorrectly.
I established the rule that tiles should have their bottom left corner on whole numbers.
While the tiles were rendering with their center being on that whole number.
So their bottom left corner was at (-0.5, -0.5).
That is incorrect.
I shifted the tiles correctly so that I have proper visual feedback. Then I started from the beginning again, checking the values and the rectangles that I am rendering. What I found was that an offset was being added to the total rectangle. While that offset was only meant to be used by the rendering code. Removing that mistake makes the region work properly (finally) for when the player is standing still. Once you start driving it all goes wrong again. That is for the ride home to figure out. But you can see how easy a mistake can be made and if that basis is not correct. Then of course the rest of the collision check will also be incorrect.
UPDATE:
Just when you think you have it, it backfires again.
Had seemingly everything working as intended, until I made the camera follow the player again.
Tadaaa, it’s wrong again.
And not just the rendering, but also the wrong tiles are picked.
So done with this code.
I guess it’s still not as easy to use as expected.
Imagine if the original chunk position were still in, then we had even more coordinate systems to worry about…