Jump to content
  • Advertisement
Sign in to follow this  

Contact caching

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

How are you searching the contact list? Box2D has a list of contacts per colliding body, so it usually only has to search through a few contacts to find a match. This could be a problem for a body with a large number of contacts, but if you are only using circles and they are all about the same size that won't be the case.

If you do use a hash table (and this is probably the easier method), watch out for memory allocations. In C++, std::unordered_map will allocate per entry, and this is slow.

There's more to making collisions go fast. I've written about it here:


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!