Is there any quick way to get all contacting bodies with specific b2bBody? for example i have 200 cricles(dynamic bodies) and want to know how many circle contacting with each circle
0
votes
1 Answers
0
votes
The most efficient way is to use the BeginContact and EndContact callbacks of the contact listener to update a list for each body, of what it is currently touching.
This page might help: http://www.iforce2d.net/b2dtut/collision-callbacks That example only tracks the number of touching bodies by using a simple integer counter, but you could also use a std::set or similar structure to keep track of which bodies they are.