Пример #1
0
 def __init__(self, canRender=0):
     self.canRender = canRender
     self.world = OdeWorld()
     self.space = OdeSimpleSpace()
     self.contactgroup = OdeJointGroup()
     self.bodyList = []
     self.geomList = []
     self.massList = []
     self.rayList = []
     self.showContacts = 0
     self.jointMarkers = []
     self.jointMarkerCount = 64
     self.meshDataList = []
     self.geomDataList = []
     self.commonObjectInfoDict = {}
     self.maxColCount = 0
     if self.canRender:
         self.odePandaRelationList = self.bodyList
         self.root = render.attachNewNode('physics root node')
     else:
         self.root = NodePath('physics root node')
     self.placerNode = self.root.attachNewNode('Placer')
     self.subPlacerNode = self.placerNode.attachNewNode('Placer Sub Node')
     self.commonObjectDict = {}
     self.commonId = 0
     self.worldAttach = self.root.attachNewNode('physics geom attach point')
     self.timingCycleLength = 10.0
     self.timingCycleOffset = 0.0
     self.timingSimTime = 0.0
     self.FPS = 60.0
     self.DTAStep = 1.0 / self.FPS
     self.DTA = 0
     self.useQuickStep = False
     self.deterministic = True
     self.numStepsInSimulateTask = 0
Пример #2
0
    def setup_ODE(self):
        # Setup our physics world
        self.world = OdeWorld()
        self.world.setGravity(0, 0, -9.81)
        self.world.initSurfaceTable(1)
        self.world.setSurfaceEntry(0, 0, 200, 0.7, 0.2, 0.9, 0.00001, 0.0,
                                   0.002)

        self.space = OdeSimpleSpace()
        self.space.setAutoCollideWorld(self.world)
        self.contacts = OdeJointGroup()
        self.space.setAutoCollideJointGroup(self.contacts)
        self.space.setCollisionEvent("on_collision")
Пример #3
0
    def ode_cols(self):
        world = OdeWorld()
        world.setGravity(0, 0, -9)
        world.initSurfaceTable(1)
        world.setSurfaceEntry(0, 0, 150, 0.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)
        space.autoCollide()

        #try ODE for collisions
        t_trimesh = OdeTriMeshData(self.terrain.getRoot(), True)
        t_geom = OdeTriMeshGeom(space, t_trimesh)
Пример #4
0
    def __init__(self, app):
        OdeWorld.__init__(self)

        self.app = app

        self.lock = Lock()

        # Creation d'un espace
        self.espace = OdeSimpleSpace()
        # Activation de la collision automatique
        self.espace.setAutoCollideWorld(self)
        # Creation d'une jointure entre les collisions
        self.contactgroup = OdeJointGroup()
        self.espace.setAutoCollideJointGroup(self.contactgroup)

        # Creation d'une liste rassemblant les elements dynamique
        self.elements = []
Пример #5
0
from direct.directbase import DirectStart
from panda3d.ode import OdeWorld, OdeSimpleSpace, OdeJointGroup
from panda3d.ode import OdeBody, OdeMass, OdeBoxGeom, OdePlaneGeom, OdeTriMeshGeom, OdeTriMeshData
from panda3d.core import BitMask32, CardMaker, Vec4, Quat
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, 150, 0.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 box
box = loader.loadModel("box")
# Make sure its center is at 0, 0, 0 like OdeBoxGeom
box.setPos(-.5, -.5, -.5)
box.flattenLight()  # Apply transform
box.setTextureOff()

# Add a random amount of boxes
boxes = []
for i in range(randint(5, 10)):
    # Setup the geometry