I'm making a simple top-down tank game using rotated rectangles to approximate the shape of a tank as seen from above. I followed this tutorial on how to use the separating axis theorem to detect collisions between rotated rectangles, and so far it's working perfectly. At the moment, though, any collision simply causes the vehicle to stop all movement, which isn't the most realistic response in all cases. For example:
- If a tank collides with a wall at a very shallow angle, it should scrape along the wall rather than freeze in place.
- If a tank rotating in place comes into contact with a wall, the force of rotation should push the tank away from the wall rather than stop completely.
However, I have no idea how to implement this in my game. Does anyone have any suggestions or tutorials? I am writing it in C++ with SFML for the graphics, and would prefer not to have to add any additional libraries.