[OLPC-Games] [OLPC library] Physics -- Newtonian mechanics.. for kids!

Eric Jordan ewjordan at gmail.com
Tue Jul 15 20:21:07 EDT 2008


Just to clarify some of these issues (I maintain JBox2d, so I know a lot
about Box2d) - two balls that hit each other will react differently
depending upon their coefficients of restitution.  In Box2d, the default
restitution is 0.0, since that's most often closest to what you want for
game objects.  That's likely why things are just moving together, the
collision is completely inelastic.  If you turn the restitution up to 1.0,
things should work better.

With the Newton's cradle thing, the problem is that the while restitution
works perfectly for two balls, when you have a chain of objects that are all
touching, the solver treats it as a single islands of contacts and solves it
"together" - this does result in a valid solution to all of the equations of
motion.  Unfortunately the equations of motion don't uniquely specify the
result of Newton's cradle, and we end up with the "wrong" correct solution
for this case - if we solved things "correctly" for this case, though, we'd
end up with bad results for other cases which are somewhat more common (an
object pinned on both sides by another one is one that comes to mind), so
it's a tough choice.  In real life the degeneracy is removed by lots of
additional microscopic variables that we don't account for in a physics
engine, alas.  Another way to think about it is that what breaks that
degeneracy happens on a time scale a lot smaller than one time step, so in
practice we always have to choose one way to break it every time, since we
don't have the ability to simulate on such a fine scale.

Sometimes leaving some space between the balls can help, as can making the
string holding them a bit longer and/or turning on the "bullet" flag for
each of the balls (which handles each collision with continuous collision
detection, thus taking care of the impulse ordering and avoiding the island
solve), but I still haven't seen any generally useful methods that can keep
Newton's cradle swinging properly for a very long time...

- Eric

On Tue, Jul 15, 2008 at 7:09 PM, Yoshiki Ohshima <yoshiki at vpri.org> wrote:

> > >  Heh, of course you can try by yourself.
> >
> > I want to know what happens in your code. Can you send it to me?
>
>   There is no code, and I don't know how to send anything.  I just
> played around it on XO, and took photos but it couldn't same data into
> Journal.
>
> > > the floor (stand still), and make another hit from the side, the
> > > momentum is shared by these two circles and both of them move together
> > > at the same speed.
> >
> > That's unphysical, and I would only program that way in a fantasy
> > setting. In a head-on elastic collision of two circles of equal mass,
> > the hitter should stop dead, transferring all of its energy and
> > momentum to the one it hit. As any pool payer knows for the case of
> > spheres. In a Newton's cradle the momentum and energy passes from ball
> > to ball at the speed of sound in the material of the balls.
>
>   If the ball is made of silly putty, something like this can happen,
> and as others pointed out (and in my second email mentions it), it is
> just wrong elasticity given to the circles.
>
> > >> Have you tried two pendula hanging from a horizontal string? Do you
> > >> get the expected transfer of energy back and forth?
> > >
> > >  Yes, but no.  I'm not sure what you mean by a horizontal string, but
> > > the string I made is not flexible enough to make it happen.
> >
> > Tie a string between two points at the same height.
> >
> > Then tie a pendulum to the string.
> >
> > Then tie another pendulum of the same length and mass to a different
> > point on the string.
> >
> >    \____/
> >     |       |
> >    o      o
> >
> > Start one pendulum in the direction perpendicular to the plane of the
> > diagram. It will gradually transfer energy and momentum to the other
> > almost completely, and then start up again while the other slows down
> > and stops, and so on.
>
>   Edward... I know what it is.  I'm just saying that there is no
> "string", it isn't trivial to make the same length or size of
> something more than one, nor there is no perpendicular plane in
> "Physics" (yet).
>
> -- Yoshiki
> _______________________________________________
> Games mailing list
> Games at lists.laptop.org
> http://lists.laptop.org/listinfo/games
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.laptop.org/pipermail/games/attachments/20080715/f6c870a9/attachment-0001.htm 


More information about the Games mailing list