def createWorldAndStuff():

    global world
    global space
    global contactgroup
    world = OdeWorld()
    world.setGravity(0, 0, -9.81)
    # The surface table is needed for autoCollide
    world.initSurfaceTable(1)
    world.setSurfaceEntry(0, 0, 15000, 0.001, 0.9, 0.9, 0.00001, 0.1, 0.002) 
    # Create a space and add a contactgroup to it to add the contact joints
    space = OdeSimpleSpace()
    space.setAutoCollideWorld(world)

    contactgroup = OdeJointGroup()
    space.setAutoCollideJointGroup(contactgroup)
Beispiel #2
0
def createWorldAndStuff():

    global world
    global space
    global contactgroup
    world = OdeWorld()
    world.setGravity(0, 0, -9.81)
    # The surface table is needed for autoCollide
    world.initSurfaceTable(1)
    world.setSurfaceEntry(0, 0, 15000, 0.001, 0.9, 0.9, 0.00001, 0.1, 0.002)
    # Create a space and add a contactgroup to it to add the contact joints
    space = OdeSimpleSpace()
    space.setAutoCollideWorld(world)

    contactgroup = OdeJointGroup()
    space.setAutoCollideJointGroup(contactgroup)
Beispiel #3
0
from pandac.PandaModules import PNMImage, PNMPainter, PNMBrush, Texture
from random import randint, random

# Setup our physics world
world = OdeWorld()
world.setGravity(0, 0, -9.81)

# The surface table is needed for autoCollide
world.initSurfaceTable(1)
world.setSurfaceEntry(0, 0, 100, 1.0, 9.1, 0.9, 0.00001, 0.0, 0.002)

# Create a space and add a contactgroup to it to add the contact joints
space = OdeSimpleSpace()
space.setAutoCollideWorld(world)
contactgroup = OdeJointGroup()
space.setAutoCollideJointGroup(contactgroup)

# Load the ball
ball = loader.loadModel("cilindroB")
ball.flattenLight() # Apply transform
ball.setTextureOff()

# Add a random amount of balls
balls = []
# This 'balls' list contains tuples of nodepaths with their ode geoms
for i in range(15):
  # Setup the geometry
  ballNP = ball.copyTo(render)
  ballNP.setPos(randint(-7, 7), randint(-7, 7), 10 + random() * 5.0)
  ballNP.setColor(random(), random(), random(), 1)
  ballNP.setHpr(randint(-45, 45), randint(-45, 45), randint(-45, 45))