From: George <pin...@gm...> - 2009-08-17 17:28:19
|
Well, I think I found the solution. The plane defines a ground-like object and not a paper-like infinitely thin surface as we're used to from math. So when the top_rail is used, the simulation assumes the ball is inside that ground object and goes crazy. Thanks for your help. On Mon, Aug 17, 2009 at 8:12 PM, Ian Mallett<geo...@gm...> wrote: > Hi, > > Long answer: > -Look at the output with raw_input. > -The code presented seems to make the sphere fall, but then fall the other > direction, and back and forth until it settles at top_rail. > -Try setting the gravity to 0, and the ball goes up indefinitely. > -I recommend moving the two for loops together. When the rails are removed, > you see that the sphere just sits there. An interaction with the rail must > be starting the sphere moving. This explains the earlier observation with > gravity. It's the top rail, not the bottom rail. > -The problem only seems to occur when top_rail is over the sphere. When it > is at the level of the sphere, the sphere moves up on top of it. When it is > a little over the sphere, we see that the sphere is still moving up. > Intuitively, I flip the normal (and the distance argument). The result is a > perfect simulation, even when the gravity is flipped. > > Short answer: > -Change top_rail=ode.GeomPlane(space, (0,1,0), 1.42) to > top_rail=ode.GeomPlane(space, (0,-1,0), -1.42). > > Ian > > > |