AABB
Tuesday I tried to fix the issue with rotation and collision. In the train back home I got somewhat distracted, but still managed to find the issue. The volume of tiles I was checking was simply too small still.

This morning I realized what I was doing incorrectly. When the entity was tilted, let’s say 45 degrees. Then the bounding box would actually be a very thin box. The functions that create a rectangle, with which I check what tiles to consider. Those just took one vector. And that vector was misrepresenting the actual box I needed.

So what I needed was a proper Axis Aligned Bounding Box basically. That’s what gets created now and voila, no more issues. Even managed it in a small amount of time.

Continuous Rotation
However there are still issues left. When you have just one static rotation then everything is fine. The player car needs to rotate and move at the same time though. Probably every frame as well.

The changes in rotation need to be considered when checking for collision. And if there is collision based on the change of rotation, then that needs to be resolved correctly. I expect this to be a pretty big change to collision. It definitely needs some good thought.

I am not sure if anyone has attempted or succeeded in using the Separating Axis Theorem together with non-static rotation. I can only assume that for this to work I need to treat rotation the same way as position. So that would mean that I have an angular velocity. I check how far the entity can rotate before we will have a collision. Then only rotate that amount, preventing penetration. Instead of resolving it when there already has been a collision. Tomorrow I’ll see how far that idea brings me.

Last modified: December 8, 2022