PreSolve Mass-Ratio Editing

Heho,


So there's two bodies and when they smack into each other only 1 of them should be affected by the collision. As Erin mentioned in another post before, this can probably be done in the PreSolve callback by editing the mass-ratio.

As a simple test, I just wanted to get rid of all the impulses of a contact:
Code:
   virtual void PreSolve(b2Contact* contact, const b2Manifold* oldManifold) {
      b2Manifold* man = contact->GetManifold();
      
      for(int i = 0; i < man->pointCount; i++) {
         man->points[i].normalImpulse = 0;
         man->points[i].tangentImpulse = 0;
      }

      //B2_NOT_USED(contact);
      B2_NOT_USED(oldManifold);
   }


Which doesn't do anything.

I also did the same thing with all the contacts outside the Step, with the same nihilistic result.


After trying for a while now, looking through the Box2D source code, and searching the forums, I simply can't figure out how to do this. Do you have a clue?


Thanks for helping,

Antoon
You should probably set a new flag on the b2Contact, like b2_dontMoveA.

In b2ContactSolver you can read this flag and make sure that invIA == 0 and invMassA == 0.

Original thread: https://box2d.org/forum/viewtopic.php?t=5042