Yesterday I mentioned that the rotation are breaking the collision system. However today I realized that the changing of rotation is only part of the problem. In the mean time I also thought about at least two potential fixes for that. The real issue here at the moment is that the SAT(Separating Azis Theorem) that I implemented just doesn’t work correctly.
I can set the rotation to a value at the beginning of the game. Then during gameplay I don’t change the rotation. At that point the SAT should work just like normal. Because that is partially why you check the axis of the entities and tiles. And since tiles won’t rotate, ever. The issue can only be with the rotated entities.
So the mission for next week is figure out why rotating an entity breaks the algorithm. I’ve already stepped through the code and at first glance everything seems correct. The only remarkable thing is that the algorithm reports a collision on one frame. The next frame it says there is plenty of space left. That only happens on diagonal tiles, since the code works fine with completely horizontal or vertical tiles. I hope I won’t spend a month on this problem though…