def SetupODE(self):
        # Create a world object
        self.world = ode.dWorld()
        self.world.setGravity(0, -9.81, 0)
        self.world.setERP(0.8)
        self.world.setCFM(1e-5)

        # Create a space object
        self.space = ode.CreateSimpleSpace()

        # Create a plane geom which prevent the objects from falling forever
        self.floor = ode.dPlane(space.id(), 0.0, 1.0, 0.0, 0.0)

        # A list with ODE bodies
        self.odebodies = []

        # A joint group for the contact joints that are generated whenever
        # two bodies collide
        self.contactgroup = ode.dJointGroup()
示例#2
0
world.setGravity( 0,-9.81,0 )
world.setERP(0.8)
world.setCFM(1E-5)

# Create a space object
space = ode.CreateSimpleSpace()

# Create a plane geom which prevent the objects from falling forever
floor = ode.dPlane(space.id(), 0.0, 1.0, 0.0, 0.0)

# A list with ODE bodies
bodies = []

# A joint group for the contact joints that are generated whenever
# two bodies collide
contactgroup = ode.dJointGroup()

# Some variables used inside the simulation loop
fps = 50
dt = 1.0/fps
running = True
state = 0
counter = 0
objcount = 0
#clk = pygame.time.Clock()
#frame=1
while running:

    counter+=1
    # State 0: Drop objects
    if state==0: