1
Graphics / Collision of rotated Rectangle
« on: October 10, 2013, 10:47:00 am »
In my game I've got collision mechanism, but it works fine only on rectangles which are not rotated. I decided to add boxes which are rotated, but, of course, my application detect collision between character and bounding box which is not rotated and is not returning real bounds of a rectangle.
I found that article about doing it: http://www.gamedev.net/page/resources/_/technical/game-programming/2d-rotated-rectangle-collision-r2604. I have not read it yet, but as I see you have to get local (not global) x-axis and y-axis of rectangle and create your own system of collision without using, in SFML, getGlobalBounds().
I've got idea how to do it that way, but I'm curious if it's possible to detect collision between rotated object with SFML functions? Or maybe you can advise me how to implement that in a quite simple way.
I found that article about doing it: http://www.gamedev.net/page/resources/_/technical/game-programming/2d-rotated-rectangle-collision-r2604. I have not read it yet, but as I see you have to get local (not global) x-axis and y-axis of rectangle and create your own system of collision without using, in SFML, getGlobalBounds().
I've got idea how to do it that way, but I'm curious if it's possible to detect collision between rotated object with SFML functions? Or maybe you can advise me how to implement that in a quite simple way.