From: Hart's A. <bha...@ya...> - 2006-04-07 03:43:46
|
hi again robert, you had your ERP (error reduction param) very high, so i tuned that lower and that caused the error of slipping below the floor to increase from -20 to -90, so the problem was your mass was too high, so i lowered that to 10 and now it works how i think you want. import ode,time 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.1) world.setCFM(1E-5) space = ode.Space() floor = ode.GeomPlane(space, (0,0,1), 0) body = ode.Body(world) M = ode.Mass() M.setBox(10, 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() time.sleep(0.01) __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |