Jump to content
  • Advertisement
Sign in to follow this  
lucky6969b

Example code wanted for Broad Phase Collision Detection.

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

I would like to learn broad phase collision detection. Could anyone provide a link to example source code for broad phase collision? Currently, I am having about 20 agents, not many, but still want to use broad phase to divide their number of comparisons. Any help would be greatly appreciated! Thanks Jack

Share this post


Link to post
Share on other sites
Advertisement

There are many ways of implementing a broad phase and there is no single correct way. It depends on many factors like whether you're in 2D or 3D, the number of entities, the average distance between entities, whether most of them are static or dynamic, etc. You could try:

 

  • Brute Force: This can actually be a good choice for a reasonable number of entities if you can make your data structures cache-friendly.
  • Spatial Partitioning: There are many examples on Quadtrees and Octrees out there.
  • Spatial Hashing: Good for many moving entities since reinsertion is fast, but has other drawbacks instead.

I've been using BepuPhysics for some time now. You can look at the source code at CodePlex.

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!