Jump to content
  • Advertisement
Sign in to follow this  
jagguy2

odd shapes collision

This topic is 3811 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If I have 2 shapes rotated on a 2D screen (not aligned with XY axis) and i want to test for a collision (overlap), then what is the best way to go. I am talking about shapes like a diamond or the axis of the rectangle dont align with XY axis. According to this I use a a straight line? http://www.harveycartel.org/metanet/tutorials/tutorialA.html DO they mean on each edge I get the formula of the straight line and test the position on some points on each object . THis way I would need to test for 2 lines on a rectangle shape. Is this the only way?

Share this post


Link to post
Share on other sites
Advertisement
Google Seperating Axis Theorum. That's what N uses (your harveycartel web reference).

Olli's tutorials are the best I've found.

[EDIT] Olli tutorial link.

[Edited by - EasilyConfused on July 11, 2008 11:11:27 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by jagguy2
If I have 2 shapes rotated on a 2D screen (not aligned with XY axis) and i want to test for a collision (overlap), then what is the best way to go.
I am talking about shapes like a diamond or the axis of the rectangle dont align with XY axis.

According to this I use a a straight line?
http://www.harveycartel.org/metanet/tutorials/tutorialA.html

DO they mean on each edge I get the formula of the straight line and test the position on some points on each object . THis way I would need to test for 2 lines on a rectangle shape.

Is this the only way?
The 'separating axis test' (which I believe is what is described in the article you linked to you) is a fairly optimal solution to this particular problem. If you're having trouble grasping it, I'd recommend re-reading the article a few times (be sure to check out the diagrams), and perhaps looking at some other references and example implementations as well.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!