0
\$\begingroup\$

I want to simulate a simple force-acceleration (rather than impulse-velocity) physical world made up entirely of disks and I'm having an irritating problem with my physics.

When two disks collide, I can calculate the changes in velocities quite easily using conservation of momentum and conservation of energy. Since this is going to be a force-based simulation, I need to calculate the forces to apply. I thought I'd use the momentum-impulse equality:

mΔv = FΔt

Sounds simple, except I don't know what to do with time(Δt). So I guess the question boils down to this: how long does the collision take? Or rather, do the two objects stick together for a period of time (Δt)?

\$\endgroup\$
10
  • 2
    \$\begingroup\$ Disks? "The" collision? Time? We have very little context here to work with. \$\endgroup\$
    – Ben
    Apr 25 '14 at 14:54
  • \$\begingroup\$ What I mean is, do the objects (disks here) stick together for a period of time? \$\endgroup\$
    – Elektito
    Apr 25 '14 at 14:57
  • 1
    \$\begingroup\$ Well that's entirely up to how your collision is set up. What language / libraries are you using? \$\endgroup\$
    – Ben
    Apr 25 '14 at 14:58
  • 1
    \$\begingroup\$ You need a lot more than this to calculate the linear velocity after collision. See these slides from a course on game physics: i58.tinypic.com/2q3ql4k.png \$\endgroup\$
    – Roy T.
    Apr 25 '14 at 15:23
  • 1
    \$\begingroup\$ In essence all you need to know is that the total of energy in the system stays equal. From that you can derive everything, but that does mean you need a lot more formula hence the slides I gave you :) \$\endgroup\$
    – Roy T.
    Apr 25 '14 at 16:55
2
\$\begingroup\$

In impulse physics everything is infinitely hard, that is the only way you can ever achieve an impulse.

In force physics, just like the real world, nothing is infinitely hard. How long a collision takes depends on how soft the involved objects are, relative to their mass.

The force between two objects is hardness * deformation, if the objects have different hardness then the harder object deform less than the softer object so that the result is the same for the two objects. This solves to:

force = [combined deformation] / (1/[hardness obj1] + 1/[hardness obj2])

That is the basic formula, it is very easy to implement. The big problem is energy conservation, you would have it with infinitely small time steps, but in a naïve implementation you won't have it. Using softer objects and a higher time resolution will bring you closer to this goal, that may be good enough in most game contexts. Using a hardness that makes the collision take an exact even number of time steps will solve the issue for simple one-on-one object collisions, so will using an advanced integration method, but I'm not sure that there is any nice way of ensuring energy preservation for collisions involving more than two objects.

\$\endgroup\$
5
  • \$\begingroup\$ I'm not very familiar with some of the concepts you mention. Will this be simplified a bit if I assume both objects are infinitely hard? \$\endgroup\$
    – Elektito
    Apr 25 '14 at 18:31
  • \$\begingroup\$ @Homayoon They can't be infinitely hard, plug that into the formula above and you will get division by zero. The not really correct way of explaining deformation is that it is how much the objects overlap. And hardness is just a variable that you tinker with until the collisions get the desired length, it should in general scale with an object's density to produce reasonable collisions. \$\endgroup\$ Apr 25 '14 at 21:22
  • 2
    \$\begingroup\$ Or, putting it a different way, if all objects are infinitely hard then you're back to impulse-based collision physics. Sounds like we may have an X/Y problem here - why is it you wanted to avoid impulses? \$\endgroup\$
    – DMGregory
    Apr 26 '14 at 10:52
  • \$\begingroup\$ @DMGregory I think I'm getting to where my real problem lies. I can't solve everything using just forces or just impulses, can I? I thought I should be able to do that, but it seems both this answer and the comments imply that it is not. Is this correct? \$\endgroup\$
    – Elektito
    Apr 27 '14 at 8:02
  • 1
    \$\begingroup\$ @Homayoon If you want a mix of infinitely hard collisions and soft collisions then no, you can't solve everything with one system. What you may be able to do is use force collisions with objects that are hard enough that the collisions look mostly like impulse collisions. \$\endgroup\$ Apr 27 '14 at 9:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .