2
\$\begingroup\$

I am starting to try and figure out polygon collision detection in my Android game. I am currently doing pixel level collision detection and it just seems to be too slow (though it works). I was looking at this tool and it seems like it would be really handy to give me a set of vertices for my images. Does anyone have any ideas about how I should go about implementing this? Basically once I have a list of vertices that form a polygon, how can I detect if polygon A intersects polygon B? I can see that these vertices can be used easily with Box2D but I want to try to do this without Box2D first.

\$\endgroup\$
2
  • \$\begingroup\$ Box2D is open source and has been ported to Java. Why not see how they do it? \$\endgroup\$ Feb 23, 2012 at 17:56
  • \$\begingroup\$ @ClassicThunder: True haha, I am looking at the source right now. As I expected it seems complicated, but I will continue to see if I can get something out of it. Thanks, I hadn't thought about that. Maybe I should just give in and use Box2D haha. \$\endgroup\$
    – DRiFTy
    Feb 23, 2012 at 18:00

1 Answer 1

2
\$\begingroup\$

Separation Axis Theorem

\$\endgroup\$
3
  • \$\begingroup\$ This a really great resource, thanks for posting that. \$\endgroup\$
    – DRiFTy
    Feb 23, 2012 at 18:33
  • \$\begingroup\$ Separating Axis Theorem and GJK are both popular choices for convex polygon collisions. \$\endgroup\$
    – Kai
    Feb 23, 2012 at 20:00
  • \$\begingroup\$ This is the way I am going to go, I think I can definitely get it to work using one of these algorithms. Thanks a lot! \$\endgroup\$
    – DRiFTy
    Feb 24, 2012 at 17:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .