when I optimize the engine I made and assumption that turn out to be too weak.
joint connect two bodies, and we know that by design at least one of the bodies must be a no zero mass.
for simplicity long, long time ago I made the rule that if a contact work on a compound, then the one body wit the compound would be body zero. and this work for a long time.
Than later I made another assumption that if a joint has a body wire zero mass then that body will be the on entry 1.
the two rule contradict each other is a contact is a compound with zero mass.
It is time to remove that compound assumption
- Code: Select all
it is this part here
void dgWorld::CalculateContacts (dgBroadPhase::dgPair* const pair, dgInt32 threadIndex, bool ccdMode, bool intersectionTestOnly)
{
dgContact* const contact = pair->m_contact;
dgBody* const body0 = contact->m_body0;
dgBody* const body1 = contact->m_body1;
const dgContactMaterial* const material = contact->m_material;
dgCollisionParamProxy proxy(contact, pair->m_contactBuffer, threadIndex, ccdMode, intersectionTestOnly);
pair->m_flipContacts = false;
proxy.m_timestep = pair->m_timestep;
proxy.m_maxContacts = DG_MAX_CONTATCS;
proxy.m_skinThickness = material->m_skinThickness;
if (body1->m_collision->IsType(dgCollision::dgCollisionScene_RTTI)) {
SceneContacts(pair, proxy);
} else if (body0->m_collision->IsType (dgCollision::dgCollisionScene_RTTI)) {
contact->SwapBodies();
pair->m_flipContacts = -1;
SceneContacts (pair, proxy);
} else if (body0->m_collision->IsType (dgCollision::dgCollisionCompound_RTTI)) {
CompoundContacts (pair, proxy);
} else if (body1->m_collision->IsType (dgCollision::dgCollisionCompound_RTTI)) {
// this brakes down if the solve assume that body zero must be a non zero mass body
contact->SwapBodies();
pair->m_flipContacts = -1;
CompoundContacts (pair, proxy);
I nee to fox that this weekend