Been searching for quite a while now and really struggling to find an easy way, or a good tutorial on how to create a collision detection system which can indicate what side on a box a collision has occurred.
I should specify that I am using SFML2 and their sprites class, this is what I currently use and it just picks up 2 sprites intersecting
//check rectangles for collision without taking into account where the collision is
bool Game::isRectCollision(sf::Sprite &sprite1, sf::Sprite &sprite2){
sf::FloatRect r1=sprite1.getGlobalBounds();
sf::FloatRect r2=sprite2.getGlobalBounds();
return r1.intersects(r2);
}
object1.velocity.x > 0
, for example, thenobject1
is coming from the left and colliding its right. I wonder if there are alternative ways, tho \$\endgroup\$