Game Development Reference
In-Depth Information
// Move it to the adjusted list.
moveToAdjusted(orderedList);
// Loop through the contacts for the first body.
Contact *bodyContact = orderedList->body[0].contacts;
while (bodyContact)
{
// Update the contact.
bodyContact->updatePenetration(positionChange, orientationChange);
// Schedule it for adjustment.
moveToAdjusted(bodyContact);
// Find out which linked list to move along on, then follow
// it to get the next contact for this body.
unsigned index = 0;
if (bodyContact->body[0] != orderedList->body[0]) index = 1;
bodyContact = bodyContact->nextObject[index];
}
if (orderedList->body[1])
{
// Do the same thing for the second body
// (omitted for brevity).
}
// Now sort the adjusted set
sortInPlace(adjustedList);
// And insert them at the correct place.
Contact *orderedListEntry = orderedList;
while (orderedListEntry)
{
if (adjustedList->penetration > orderedListEntry->penetration)
{
Contact *contactToInsert = adjustedList;
adjustedList = adjustedList->nextInOrder;
insertIntoList(contactToInsert, orderedListEntry);
}
}
}
Search Nedrilad ::




Custom Search