Пример #1
0
    def __init__(self, app):
        self.app = app
        self.body = {}
        
        app.world = self

        self.frameListener = WorldFrameListener(self)
        app.root.addFrameListener(self.frameListener)
        self.worldNode = app.sceneManager.getRootSceneNode().createChildSceneNode("World")
        
        self.physCollisionConfiguration = bullet.btDefaultCollisionConfiguration() 
        self.physDispatcher = bullet.btCollisionDispatcher (self.physCollisionConfiguration)
        
        # self.physBroadphase = bullet.btAxisSweep3(bullet.btVector3(-1000, -1000, -1000), bullet.btVector3(1000, 1000, 1000))
        self.physBroadphase = bullet.btDbvtBroadphase()
        self.physGhostCallback = bullet.btGhostPairCallback()
        self.physBroadphase.getOverlappingPairCache().setInternalGhostPairCallback(self.physGhostCallback)
        self.physSolver = bullet.btSequentialImpulseConstraintSolver() 
        self.physWorld = bullet.btDiscreteDynamicsWorld(self.physDispatcher, self.physBroadphase, self.physSolver, self.physCollisionConfiguration)
        self.physWorld.setGravity(bullet.btVector3(0, -10, 0))

        # self.cells = {}
        self.entities = {}

        self.setupWorld()
Пример #2
0
    def __init__(self):
        sf.Application.__init__(self)
        patchDecl = ogre.VertexDeclaration()
        self.patchCtlPoints = 0
        # Create the global log manager instance
        self.logMgr = ogre.LogManager()
        # create the instance of our log listener
        self.myLog = MyLog()
        # create a "log"
        self.currentLog = ogre.LogManager.getSingletonPtr().createLog(
            "dummy.log",
            True,  # it's the default log
            False,  # I don't want it sent to the debug window
            True,  # it's a virtual log, so you need a listener :)
        )
        # register our listener
        self.currentLog.addListener(self.myLog)

        self.collisionConfiguration = bullet.btDefaultCollisionConfiguration()
        self.dispatcher = bullet.btCollisionDispatcher(self.collisionConfiguration)

        worldAabbMin = bullet.btVector3(-1000, -1000, -1000)
        worldAabbMax = bullet.btVector3(1000, 1000, 1000)
        maxProxies = 32766

        self.broadphase = bullet.btAxisSweep3(worldAabbMin, worldAabbMax, maxProxies)

        self.solver = bullet.btSequentialImpulseConstraintSolver()
        self.world = bullet.btDiscreteDynamicsWorld(
            self.dispatcher, self.broadphase, self.solver, self.collisionConfiguration
        )
        self.world.stepSimulation(0.1)
        self.world.stepSimulation(1)
        print "INIT OK"
Пример #3
0
 def setupBullet( self ):
     self.collisionConfiguration = bullet.btDefaultCollisionConfiguration() 
     self.dispatcher = bullet.btCollisionDispatcher (self.collisionConfiguration) 
     worldAabbMin = bullet.btVector3(-1000,-1000,-1000) 
     worldAabbMax = bullet.btVector3(1000,1000,1000) 
     maxProxies = 32# 766 
     self.broadphase = bullet.btAxisSweep3(worldAabbMin, worldAabbMax, maxProxies) 
     self.solver = bullet.btSequentialImpulseConstraintSolver() 
     self.world = bullet.btDiscreteDynamicsWorld(self.dispatcher, self.broadphase , self.solver, self.collisionConfiguration) 
     self.world.stepSimulation(0.1)
     self.world.stepSimulation(1)
     print "Leaving setup"
Пример #4
0
    def init(self, gravity):
        self.collisionConfiguration = bullet.btDefaultCollisionConfiguration()
        self.dispatcher = bullet.btCollisionDispatcher (self.collisionConfiguration)

        
        worldAabbMin = bullet.btVector3(-20000,-1000,-20000)
        worldAabbMax = bullet.btVector3(20000,1000,20000)
        self.broadphase = bullet.btAxisSweep3(worldAabbMin, worldAabbMax);

        self.solver = bullet.btSequentialImpulseConstraintSolver();

        self.world = bullet.btDiscreteDynamicsWorld(self.dispatcher, self.broadphase, self.solver,
                                                    self.collisionConfiguration);
        self.world.getDispatchInfo().m_enableSPU = True
        self.world.setGravity(bullet.btVector3(0,gravity,0));

        self.world.stepSimulation(0);
Пример #5
0
import sys
sys.path.insert(0,'..')
import PythonOgreConfig

import ogre.renderer.OGRE as ogre
import ogre.physics.bullet as bullet
t = bullet.btTransform()
ms = bullet.btDefaultMotionState (t)
s = bullet.btBoxShape(bullet.btVector3(10,10,10))
body = bullet.btRigidBody(1, ms, s)
print body


collisionConfiguration = bullet.btDefaultCollisionConfiguration()
dispatcher = bullet.btCollisionDispatcher (collisionConfiguration)

worldAabbMin = bullet.btVector3(-1000,-1000,-1000)
worldAabbMax = bullet.btVector3(1000,1000,1000)
maxProxies = 32766

broadphase = bullet.btAxisSweep3(worldAabbMin, worldAabbMax, maxProxies)

solver = bullet.btSequentialImpulseConstraintSolver()

world = bullet.btDiscreteDynamicsWorld(dispatcher, broadphase , solver, collisionConfiguration)
world.getDispatchInfo().m_enableSPU = True
world.setGravity(bullet.btVector3(0,-10,0))

print world
print dir(world)
print solver