void processAddedJoints()
{
if( _jointAddList.Count > 0 )
{
foreach( Joint joint in _jointAddList )
{
// Connect to the world list.
jointList.Add( joint );
// Connect to the bodies' doubly linked lists.
joint.edgeA.joint = joint;
joint.edgeA.other = joint.bodyB;
joint.edgeA.prev = null;
joint.edgeA.next = joint.bodyA.jointList;
if( joint.bodyA.jointList != null )
joint.bodyA.jointList.prev = joint.edgeA;
joint.bodyA.jointList = joint.edgeA;
// WIP David
if( !joint.isFixedType() )
{
joint.edgeB.joint = joint;
joint.edgeB.other = joint.bodyA;
joint.edgeB.prev = null;
joint.edgeB.next = joint.bodyB.jointList;
if( joint.bodyB.jointList != null )
joint.bodyB.jointList.prev = joint.edgeB;
joint.bodyB.jointList = joint.edgeB;
Body bodyA = joint.bodyA;
Body bodyB = joint.bodyB;
// If the joint prevents collisions, then flag any contacts for filtering.
if( joint.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( onJointAdded != null )
onJointAdded( joint );
// Note: creating a joint doesn't wake the bodies.
}
_jointAddList.Clear();
}
}