def __init__(self): sf.Application.__init__(self) # Set up the physics world self.world = ode.dWorld() self.world.setGravity(0, -9.81, 0) ssid = ode.dSimpleSpace() self.space = ode.dSimpleSpace(1) # dQuadTreeSpace, dHashSpace self.contactgroup = ode.JointGroup() self.bodyList = []
SIDE = 0.2 ## side length of a box MASS= 1.0 ## mass of a box RADIUS =0.1732 ## sphere radius ## dynamics and collision objects body=[] box=[] joint = [] for i in range(NUM): body.append(ode.dBody() ) box.append(ode.dBox() ) joint.append (ode.dBallJoint() ) contactgroup= ode.dJointGroup() space = ode.dSimpleSpace(None) world = ode.dWorld() ## this is called by space.collide when two objects in space are ## potentially colliding. def nearCallback (data, o1, o2): ## exit without doing anything if the two bodies are connected by a joint b1 = ode.dGeomGetBody(o1) b2 = ode.dGeomGetBody(o2) if b1 and b2 and ode.dAreConnected (b1,b2): return ## @@@ it's still more convenient to use the C interface here.