0

i have a little problem. For the collision in SFML, i use the intersects() function.

But this works with a rectangle. How do you block the character with a triangle, or a rotated shape like the one on this screenshot ?

enter image description here

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
  • 2
    I think you should be able to deduct the answer from answer to this question: https://stackoverflow.com/questions/10962379/how-to-check-intersection-between-2-rotated-rectangles – Hawky Nov 11 '20 at 20:32
  • Does this answer your question? [How to check intersection between 2 rotated rectangles?](https://stackoverflow.com/questions/10962379/how-to-check-intersection-between-2-rotated-rectangles) – Jessie Lesbian Nov 12 '20 at 10:58
  • SFML is a multimedia library, it's most usable for input and output. For collision detection it's probably better to use physics library (like Box2D). – Montreal Nov 13 '20 at 03:45

1 Answers1

0

I am for this problem using PixelPerfectCollision(sf::Sprite &object1, sf::Sprite object&2) from Collison namespace which i found on github-sfml collision. I usually make new Collision.h and Collision.cpp to my project directory.

Jakkkub
  • 55
  • 6