Does getGlobalBounds really work on rotating objects? I'm trying to detect a collision and currently the collision is setting off even when it's not intersecting the intended object. I'm on Ubuntu and believe I am running SFML 2.0. Below is a rough, off hand copy of the part of code in question, any responses as to why it might not be working would be greatly appreciated
.
Also, if the code below for some reason doesn't compile in your compiler, remember it was a quick snippet put together to help explain my problem and that the actual code in question is error free so u can pretty much ignore any insignificant syntax errors lol.
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
sf::RenderWindow window(sf::VideoMode(800,600),"");
bool play = true;
sf::RectangleShape rocks;
rocks.setSize(sf::Vector2f(800,50));
rocks.setFillColor(sf::Color(169,169,169));
rocks.setPosition(400,200);
sf::RectangleShape rect;
rocks.setSize(sf::Vector2f(50,50));
rocks.setFillColor(sf::Color::Black);
rocks.setPosition(350,250);
while(play == true){
rocks.rotate(1);
if(rocks.getGlobalBounds().intersects(rect.getGlobalBounds()) == true){
static int g = 0;
if (g <=5){
rect.setFillColor(sf::Color::Yellow);
g++;
}
if (g >5){
rect.setFillColor(sf::Color::Blue);
g++;
if (g >= 11) g = 0;
}
window.draw(rect);
window.draw(rocks);
window.display();
}
}