// iterate through gLocalContacts and filtered out "near contact" inline void _OptimizeLocalContacts(sData& cData) { int nContacts = cData.nContacts; for (int i = 0; i < nContacts-1; i++) { for (int j = i+1; j < nContacts; j++) { if (_IsNearContacts(cData.gLocalContacts[i],cData.gLocalContacts[j])) { // If they are seem to be the same then filtered // out the least penetrate one if (_IsBetter(cData.gLocalContacts[j],cData.gLocalContacts[i])) { cData.gLocalContacts[i].nFlags = 0; // filtered 1st contact } else { cData.gLocalContacts[j].nFlags = 0; // filtered 2nd contact } // NOTE // There is other way is to add two depth together but // it not work so well. Why??? } } } }
// iterate through gLocalContacts and filtered out "near contact" void sTrimeshCapsuleColliderData::_OptimizeLocalContacts() { int nContacts = m_ctContacts; for (int i = 0; i < nContacts-1; i++) { for (int j = i+1; j < nContacts; j++) { if (_IsNearContacts(m_gLocalContacts[i],m_gLocalContacts[j])) { // If they are seem to be the samed then filtered // out the least penetrate one if (_IsBetter(m_gLocalContacts[j],m_gLocalContacts[i])) { m_gLocalContacts[i].nFlags = 0; // filtered 1st contact } else { m_gLocalContacts[j].nFlags = 0; // filtered 2nd contact } // NOTE // There is other way is to add two depth together but // it not work so well. Why??? } } } }