def sphere(self, world): r = 0.1 m = 1.0 mass = dMass() dMassSetZero(byref(mass)) dMassSetSphereTotal(byref(mass), m, r) sphere = dBodyCreate(world) dBodySetMass(sphere, byref(mass)) return sphere
def ballGeom(self, world, space): mass = dMass() m = 10.0 r = 0.2 dMassSetZero(byref(mass)) dMassSetSphereTotal(byref(mass), m, r) ballBody = dBodyCreate(world) dBodySetMass(ballBody, byref(mass)) ballGeom = dCreateSphere(space, r) dGeomSetBody(ballGeom, ballBody) return ballGeom
def ball(self, world, space): m = 1.0 r = 0.1 mass = dMass() dMassSetZero(byref(mass)) dMassSetSphereTotal(byref(mass), m, r) body = dBodyCreate(world) dBodySetMass(body, byref(mass)) geom = dCreateSphere(space, r) dGeomSetBody(geom, body) ball = {'body': body, 'geom': geom} return ball
def legGeoms(self, world, space): legGeoms = [] for m, l, r in [(2.0, 0.7, 0.04), (2.0, 0.7, 0.02)]: direction = 3 mass = dMass() dMassSetZero(byref(mass)) dMassSetCapsuleTotal(byref(mass), m, direction, r, l) legBody = dBodyCreate(world) dBodySetMass(legBody, byref(mass)) legGeom = dCreateCapsule(space, r, l) dGeomSetBody(legGeom, legBody) legGeoms.append(legGeom) return legGeoms
def legGeom(self, world, space): m = 0.001 r = 0.025 l = 1.0 direction = 3 mass = dMass() dMassSetZero(byref(mass)) dMassSetCapsuleTotal(byref(mass), m, direction, r, l) legBody = dBodyCreate(world) dBodySetMass(legBody, byref(mass)) legGeom = dCreateCapsule(space, r, l) dGeomSetBody(legGeom, legBody) return legGeom