Jump to content
  • Advertisement
Sign in to follow this  
m@

quadtree collision system??

This topic is 3931 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

Hello. So I'm trying to work out what is the best solution to my collision detection problems. Keep in mind that this is for a 2D game that will look similar to the image below. I've read up on space partitioning but some seem over the top for what I need...? Or am I wrong. Quad trees seem like the most appropriate or maybe bounding boxes for each edge? I'm just not sure. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
As far as collision goes, spatial partitioning is used to determine which objects will potentially collide with one another, i.e., are they close enough to be worth a collision test. The partition itself does none of the actual processing. You can track with quad-tree sectors each of your objects inhabits (based on the object's position and size) and use that information to determine which other objects you'll need to test it against (using whatever method you want, probably rectangle or circle, or a combination of both). In other words, you only test against objects that occupy the same sectors.

Share this post


Link to post
Share on other sites
Say I'm testing a sector for collisions. What happens if an object/edge covers more than one sector?
Do I test the whole edge/object?
thanks

Share this post


Link to post
Share on other sites
I found this example code for anybody interested.
http://nomis80.org/code/octree.html

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!