Home > Software engineering >  How to resolve this physical collision with impulses?
How to resolve this physical collision with impulses?

Time:12-01

I've started to write a physics engine but became stuck on some physics of resolving collisions. Let's say I have this situation:

enter image description here

I.e. body B is going towards body A at the speed of 1 space units/time unit. Both A and B have the same mass of 1 unit. Let's consider a completely elastic collision.

I've read in a book (Game Physics Engine Development) that an impulse-based approach can be used to resolve the collision (i.e. find out the linear and angular velocities of both bodies after the collision). As I understand it, it should work like this:

  1. When the bodies collide, I get the point of the collision and the collision normal.
  2. At the point of the collision I consider only two points colliding in the direction of the normal (the points at which the bodies are touching, i.e. I ignore the shapes of both bodies) and I compute the new velocities of these two colliding points (this is easy to do, there is a simple formula found e.g. on Wikipedia).
  3. I find an impulse such that when applied to both bodies at this point it achieves the computed velocities for these two points.

Now the problem arises when I consider that from a physical point of view both momentum and kinetic energy need to be conserved. With these constraints in mind there is seemingly no solution, because:

When B collides with A, B should come to complete stop and transfer all its momentum and kinetic energy to A, according to elastic collision formula. In order for linear momentum to stay conserved, A then has to start linearly moving left at the same speed as B was before the collision (as they have the same mass). So now A has the same kinetic energy as B had, which however means that A cannot come into rotation because that would add additional kinetic energy to it (as rotating adds kinetic energy as well as linear motion), breaking the conservation of kinetic energy. Nevertheless, the physically correct solution IS for A to both move linearly to the left AND rotate as B colliding at this location exerts torque (and I've also checked real life object behave this way). Note that we cannot take away some energy of A's linear motion and add it to the rotation as that breaks the conservation of linear momentum.

The only "real" solution is that B doesn't come to complete stop and keeps some momentum while A will be both moving left and rotating. But this doesn't seem to be doable with the impulse-based approach that only takes into account the two colliding points, the elastic collision formula simply say the point at B should come to stop and as B cannot receive any torque (the collision happens in its middle), the only way to fulfill this is for B to stop moving.

So is there something I missed? Is the impulse-based approach just not physically correct? I appreciate any insight and suggestions on how to correctly resolve the collision. Thanks!

CodePudding user response:

The formulas that you're looking at are for the collision of two point masses. Point masses can't have angular momentum, and so the formulas have no room for that term.

You have to go back to first principles.

Suppose that an edge collides with another body at a point (think corner hitting an edge). Then a specific impulse is imparted at that point, in a direction normal to the edge. (Any other direction would have required friction, which would make this a non-elastic collision.) The opposite impulse is imparted to the other body, along the same vector. Imparting opposite impulses to both bodies is sufficient to guarantee both conservation of momentum and angular momentum. But conservation of energy is going to take some work.

Next, what happens when we impart that momentum? As this physics answer says, we impart momentum as if the impulse happened to the center of mass. We impart angular momentum equal to the cross product of the impulse and the moment arm (the vector describing how much the impulse misses the center of mass). This will cause the body to start rotating at a rate of the impulse divided by the moment of inertia.

You get kinetic energy from the motion of the center of mass, but also kinetic energy from its rotation.

So in your 2-D collision you now have the following facts:

  1. The mass of each body.
  2. The velocities of each body.
  3. The moment of inertia of each velocity.
  4. The angular velocity of each body.
  5. The moment arm of the line of force for each body.

You can now calculate the kinetic energy of the whole system, as a function of the magnitude of the specific impulse. Unlike the point mass, ALL of these factors play into it, making the equation complicated. However, like the point mass, you'll get a quadratic equation with 2 solutions. One solution is 0 impulse imparted (representing the system before the collision), and the other is your answer afterwards. Complete with changes to the momentum and angular momentum of both systems.

  • Related