Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Help with pixel perfect collision on convex shapes.  (Read 3142 times)

0 Members and 1 Guest are viewing this topic.

ohgodmanyo

  • Newbie
  • *
  • Posts: 4
    • View Profile
Help with pixel perfect collision on convex shapes.
« on: June 28, 2021, 05:22:52 pm »
When I use the intersects() function, it only uses the hitboxes as a rectangle i think and it isn't accurate enough. I have already heard of flood fill and all of that, but I am struggling with implementing it. I would appreciate if someone could just put the code down there to help me get perfect pixel collisions on convex polygons.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Help with pixel perfect collision on convex shapes.
« Reply #1 on: June 30, 2021, 02:24:35 pm »
Pixel Perfect collision detection is pretty much always overkill, plus it won't help you with implementing the reaction steps after the collision.

But you can find such (and other) implementation here: https://github.com/SFML/SFML/wiki/Source%3A-Simple-Collision-Detection-for-SFML-2
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything