I think I need to re-explain my problem.
I am using the tmxloader to create MapObject to be able to check collisions around my map.
This is an illustration of a map and a player inside it:
http://i.imgur.com/cDzCcsJ.pngMy current collision checking is based on my globalBounds, meaning, it will generate a sf::FloatRect with the global bounds of my sprite and it will pass the tmx::MapObject 4 points based on the float rect.
So I end up with something like this (red=collision rect, blue=actual player and purple is a object to check if they are colliding):
http://i.imgur.com/i6f0ZH4.pngBasically what happens there is that the red rectangle identifies a collison when in reality they didnt collide yet.
The solution for this problem is of course to put the points exactly on the edges of the rectangle.
Afaik, there is no option to rotate a tmx::MapObject.
I'd appreciate any help, I have tried what you guys suggested but it dosent seem to work properly (maybe I implemented wrong).
This is my original function:
tmx::MapObject Player::GetRect()
{
sf::FloatRect fr = this->getGlobalBounds();
sf::RectangleShape rs;
rs.setPosition(this->getPosition());
rs.setSize(sf::Vector2f(32,32));
rs.setOrigin(16, 16);
rs.setRotation(this->getRotation());
tmx::MapObject mo;
mo.SetPosition(sf::Vector2f(fr.left, fr.top));
mo.AddPoint(rs.getPoint(1));
mo.AddPoint(rs.getPoint(2));
mo.AddPoint(rs.getPoint(3));
mo.AddPoint(rs.getPoint(4));
mo.CreateDebugShape(sf::Color::Magenta);
return mo;
}
I hope I was clear enough now.