SFML community forums

Help => General => Topic started by: coolhome on July 17, 2009, 04:55:14 am

Title: Sprite Rotation + Collision Check = Question
Post by: coolhome on July 17, 2009, 04:55:14 am
Hello. I got a question that I've ran into in my game development. Lets say we have a object thats 200x100. We set the center to the exact middle and rotate it. Now when we check if the player box intersects with the odd rotating shape how do we do that correctly?

Sinces its rotating sf::IntRect doesn't have a rotate feature.

or am I completey wrong and off track here :P

Thanks,
Preston Alvarado
Title: Sprite Rotation + Collision Check = Question
Post by: Laurent on July 17, 2009, 08:40:04 am
You have to use the separate axis algorithm. It can find intersections between arbitrary polygons, so it may be slightly simpler for two 2D rectangles.
Title: Sprite Rotation + Collision Check = Question
Post by: Nexus on July 17, 2009, 01:33:39 pm
Maybe this site helps you:
http://www.metanetsoftware.com/technique/tutorialA.html