Genbox / VelcroPhysics

High performance 2D collision detection system with realistic physics responses.
MIT License
672 stars 115 forks source link

Collide() skips Contacts #41

Closed nkast closed 3 years ago

nkast commented 7 years ago

When a Contact is Destroyed it gets removed from the ContactList. That means that the next Contact is skipped, because all Contacts in the list from position [i] are shifted by one.

https://github.com/VelcroPhysics/VelcroPhysics/blob/master/VelcroPhysics/Collision/ContactSystem/ContactManager.cs#L265-L266 https://github.com/VelcroPhysics/VelcroPhysics/blob/master/VelcroPhysics/Collision/ContactSystem/ContactManager.cs#L273-L274 https://github.com/VelcroPhysics/VelcroPhysics/blob/master/VelcroPhysics/Collision/ContactSystem/ContactManager.cs#L281-L282 https://github.com/VelcroPhysics/VelcroPhysics/blob/master/VelcroPhysics/Collision/ContactSystem/ContactManager.cs#L306-L307

Genbox commented 7 years ago

Ohhh, this might be the source of a bug I've spent ages tracking down. Thank you for reporting it! I've built a new graph datastructure to hold contact information. It solves this issue, so I'll close it once I have it correctly implemented.