Skip to content

erasing/inserting body in the same place will (?) break collider

If body ID is deleted then replaced by a new one, the bound dispatcher will create a new bound, but the collider will still have a copy of values from the old one. Fortunately it is harmless, since the collider will update the values based on current body->bound before doing the sort. It will be seen by the collider as if body ID was not deleted but, instead, moved to a different place.

Now the bug: if a new body is created in the same place (approximately) as the old one, then the collider will not detect any move in the sort phase and no interactions will be created.

A secondary bug that can be fixed ion the same move: https://github.com/yade/trunk/blob/master/pkg/common/InsertionSortCollider.cpp#L125 If 2*nBodies-BBsize is more than 0, then we are pushing to a a vector that has not been cleared.

Original bug report by Bruno Chareyre on 2012-05-21 : https://bugs.launchpad.net/yade/+bug/1002524

Edited by Janek Kozicki