void processRemovedJoints()
{
if( _jointRemoveList.Count > 0 )
{
foreach( Joint joint in _jointRemoveList )
{
bool collideConnected = joint.collideConnected;
// Remove from the world list.
jointList.Remove( joint );
// Disconnect from island graph.
Body bodyA = joint.bodyA;
Body bodyB = joint.bodyB;
// Wake up connected bodies.
bodyA.isAwake = true;
// WIP David
if( !joint.isFixedType() )
{
bodyB.isAwake = true;
}
// Remove from body 1.
if( joint.edgeA.prev != null )
{
joint.edgeA.prev.next = joint.edgeA.next;
}
if( joint.edgeA.next != null )
{
joint.edgeA.next.prev = joint.edgeA.prev;
}
if( joint.edgeA == bodyA.jointList )
{
bodyA.jointList = joint.edgeA.next;
}
joint.edgeA.prev = null;
joint.edgeA.next = null;
// WIP David
if( !joint.isFixedType() )
{
// Remove from body 2
if( joint.edgeB.prev != null )
{
joint.edgeB.prev.next = joint.edgeB.next;
}
if( joint.edgeB.next != null )
{
joint.edgeB.next.prev = joint.edgeB.prev;
}
if( joint.edgeB == bodyB.jointList )
{
bodyB.jointList = joint.edgeB.next;
}
joint.edgeB.prev = null;
joint.edgeB.next = null;
}
// WIP David
if( !joint.isFixedType() )
{
// If the joint prevents collisions, then flag any contacts for filtering.
if( collideConnected == false )
{
ContactEdge edge = bodyB.contactList;
while( edge != null )
{
if( edge.other == bodyA )
{
// Flag the contact for filtering at the next time step (where either
// body is awake).
edge.contact.filterFlag = true;
}
edge = edge.next;
}
}
}
if( onJointRemoved != null )
{
onJointRemoved( joint );
}
}
_jointRemoveList.Clear();
}
}