Hi, On Nov 30, 2007 9:30 AM, Greg Ewing <[EMAIL PROTECTED]> wrote: > Matt Smith wrote: > > I can't quite get my head around WHY the ball sinks into the ground if I > > don't set ypos back to 384 but it certainly works. > > It's probably because you're applying gravity to the ball > even when it's touching the ground. So it repeatdly gets > accelerated downwards for one time step, then moved back > up to ground level. > > In real life, when the ball is touching the ground, the > downward force of gravity is balanced by an upward force > from the ground, so the net acceleration is zero. You > can model that by only applying gravity if the ball is > above ground level. >
I believe this is the most reliable solution. (AFAIK there is no upward force though; it's more to do with the pressure the object exerts being insufficient to penetrate the ground. So for a simple physics simulation, this solution is also more correct.) Matt: I assume you didn't mean to use a suggestive subject line, Every time I look at my mail I see this conversation, read the subject line rather differently than you intended, and delete it. And then someone posts another reply, so it appears again.. ._.