From: Hart's A. <bha...@ya...> - 2006-04-06 20:33:06
|
hi robert, try this: world.setERP(0.2) world.setCFM(0.05) and every frame do: v = vec3( body.getLinearVel() ) body.addForce( -v*0.1 ) # this add air friction your mass looks pretty high also, i usally keep in ranges of 0-100 good luck, -brett --- Robert Reed <tif...@ho...> wrote: > Help! > ok, I tried to boil down the pyode tutorial 3 to a very simple 38 line > program just to test it. There are only two bodies - a plane and a box. > The print function at the bottom is the only output. In theory, the box > should fall and stop. > > Interestingly, the callback seems to be called at the correct time (when z > is just less than 5) but the box falls too far (say -20) and then bounces > too high (back to near 46). It's like the plane is made of very soft > rubber. Tutorial 3 does not display this behavior - the blocks fall and > stop. > > I have been playing with this code far too long - adjusting various > parameters (bounce, etc) with no luck. I must be missing something > obvious... > > Any help would be greatly appreciated. Thanks! > > Here is the code: > > import ode > > def near_callback(args, geom1, geom2): > contacts = ode.collide(geom1, geom2) > world, contactgroup = args > for c in contacts: > c.setBounce(0.2) > c.setMu(5000) > j = ode.ContactJoint(world, contactgroup, c) > j.attach(geom1.getBody(), geom2.getBody()) > > contactgroup = ode.JointGroup() > world = ode.World() > world.setGravity( (0, 0, -9.81) ) > world.setERP(0.8) > world.setCFM(1E-5) > > space = ode.Space() > > floor = ode.GeomPlane(space, (0,0,1), 0) > > body = ode.Body(world) > M = ode.Mass() > M.setBox(10000, 10, 10, 10) > body.setMass(M) > geom = ode.GeomBox(space, (10, 10, 10)) > geom.setBody(body) > body.setPosition((50, 50, 50)) > > fps = 80.0 > dt = 1.0/fps > > while True: > pos = body.getPosition() > print 'z = ', pos > space.collide((world, contactgroup), near_callback) > world.step(dt) > contactgroup.empty( > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Pyode-user mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyode-user > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |