示例#1
0
def create_box(world, space, density, lx, ly, lz):
    """Create a box body and its corresponding geom."""

    # Create body
    
    body = ode.dBody(world.id())
    M = ode.dMass()
    M.setBox(density, lx, ly, lz)
    body.setMass(M)

    # Set parameters for drawing the body
    body.shape = "box"
    body.boxsize = (lx, ly, lz)

    # Create a box geom for collision detection
    geom = ode.dCreateBox(space.id(), lx,ly,lz )
    ode.dGeomSetBody ( geom, body.id() )
    

    return body