From: George <pin...@gm...> - 2009-08-17 09:12:24
|
import ode BD=.0615 BR=BD/2 def c_callback(args, geom1, geom2): contacts=ode.collide(geom1, geom2) world, contact_group = args for c in contacts: c.setBounce(.7) c.setMu(5000) j = ode.ContactJoint(world, contact_group, c) j.attach(geom1.getBody(), geom2.getBody()) world=ode.World() space=ode.Space() contact_group=ode.JointGroup() world.setGravity((0,-9,0)) top_rail=ode.GeomPlane(space, (0,1,0), 1.42) bottom_rail=ode.GeomPlane(space, (0,1,0), 0) bballs=[ode.Body(world) for i in range(1)] for bball in bballs: M=ode.Mass() M.setSphere(2500., BR) bball.setMass(M) geom=ode.GeomSphere(space, BR) geom.setBody(bball) for bball in bballs: bball.setPosition((1,0.8,1) ) bball.addForce((0,0,0)) dt=.01 while(1): space.collide((world,contact_group), c_callback) world.step(dt) print bballs[0].getPosition() contact_group.empty() The above works fine. But if I change the ygravity from -9 to 9 the ball doesn't bounce on the top_rail, it just goes through. Why? |