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\$
  • \$\begingroup\$ Box2D is open source and has been ported to Java. Why not see how they do it? \$\endgroup\$ – ClassicThunder Feb 23 '12 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 '12 at 18:00
2
\$\begingroup\$

Separation Axis Theorem

\$\endgroup\$
  • \$\begingroup\$ This a really great resource, thanks for posting that. \$\endgroup\$ – DRiFTy Feb 23 '12 at 18:33
  • \$\begingroup\$ Separating Axis Theorem and GJK are both popular choices for convex polygon collisions. \$\endgroup\$ – Kai Feb 23 '12 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 '12 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.