示例#1
0
def make_battery(world, position=(0, 0, 0)):
    mass = Mass()
    mass.setBox(battery_density, 70, 25, 35)
    body = Body(world)
    body.setMass(mass)
    body.setPosition(position)
    return body
示例#2
0
def make_servo(world, position=(0, 0, 0)):
    mass = Mass()
    mass.setBox(servo_density, 40, 20, 35)
    body = Body(world)
    body.setMass(mass)
    body.setPosition(position)
    return body
示例#3
0
def make_lower_leg(world):
    lower_leg_mass = Mass()
    lower_leg_mass.setBox(body_density, 30, 100, 5)
    lower_leg = Body(world)
    lower_leg.setMass(lower_leg_mass)
    servo = make_servo(world)
    fix(world, lower_leg, servo)
    return lower_leg
示例#4
0
def make_body(world):
    mass = Mass()
    mass.setBox(body_density, 240, 27, 150)
    body = Body(world)
    body.setMass(mass)
    fix(world, body, make_battery(world, (0, 27 / 2, -(150 / 2 - 35 / 2))))
    fix(world, body, make_battery(world, (0, 27 / 2, 150 / 2 - 35 / 2)))
    fix(world, body, make_servo(world, (240 / 2 - 30, 0, 150 / 2)))
    fix(world, body, make_servo(world, (240 / 2 - 30, 0, -150 / 2)))
    fix(world, body, make_servo(world, (-(240 / 2 - 30), 0, 150 / 2)))
    fix(world, body, make_servo(world, (-(240 / 2 - 30), 0, -150 / 2)))
    return body
示例#5
0
def make_upper_leg(world):
    upper_leg_mass = Mass()
    upper_leg_mass.setBox(body_density, 30, 100, 5)
    upper_leg = Body(world)
    upper_leg.setMass(upper_leg_mass)
    return upper_leg
示例#6
0
 def create_mass(self, density, dimensions):
     width, height, depth = dimensions
     mass = Mass()
     mass.setBox(density, width, height, depth)
     return mass