Apr 18, 2012 at 6:46 PM
Edited Apr 18, 2012 at 7:16 PM
I have some sensors that keep a list of objects with OnCollision and OnSeparation. However, when one body is disposed, the OnSeparation event is not raised in the sensor. Is that reasonable? I thought after disposing, OnSeparations would be invoked since
there is indeed a separation.
Could it be possible to modify the Dispose method in Body so OnSeparation can be raised for those touching objects in the ContactList?
public class Body
public void Dispose()
ContactEdge contactEdge = ContactList;
while (contactEdge != null && (contact = contactEdge.Contact) != null)
//Report the separation to both participants:
if (contact.FixtureA != null && contact.FixtureA.OnSeparation != null)
//Reverse the order of the reported fixtures. The first fixture is always the one that the
//user subscribed to.
if (contact.FixtureB != null && contact.FixtureB.OnSeparation != null)
contactEdge = contactEdge.Next;
IsDisposed = true;
I suppose that's okay as long as the Dispose method is not executed from World.Step(...). Can you agree with me?