A contact edge is used to connect bodies and contacts together in a contact graph where each body is a node and each contact is an edge. A contact edge belongs to a doubly linked list maintained in each attached body. Each contact has two contact nodes, one for each attached body.
 internal void UpdateContacts(ContactEdge contactEdge, bool value)
 {
 #if USE_ACTIVE_CONTACT_SET
 if(value)
 {
     while(contactEdge != null)
     {
         var c = contactEdge.Contact;
         if (!ActiveContacts.Contains(c))
         {
             ActiveContacts.Add(c);
         }
         contactEdge = contactEdge.Next;
     }
 }
 else
 {
     while (contactEdge != null)
     {
         var c = contactEdge.Contact;
         if (!contactEdge.Other.Awake)
         {
             if (ActiveContacts.Contains(c))
             {
                 ActiveContacts.Remove(c);
             }
         }
         contactEdge = contactEdge.Next;
     }
 }
 #endif
 }
Beispiel #2
0
 IEnumerable<ContactEdge> EnumerateContacts(ContactEdge first)
 {
     while (first != null)
     {
         yield return first;
         first = first.Next;
     }
 }