Exemplo n.º 1
0
        physicsMgr.addShape[shapetype](body, size)

    def addComplexShape(self, body, model, shapetype):
        geom = model.node().getGeom(0)
        physicsMgr.addShape[shapetype](body, geom)


"""Testing ---------------------------------------------"""

if __name__ == '__main__':

    from direct.directbase import DirectStart

    from physicsmanager import PhysicsManager

    physicsMgr = PhysicsManager()

    physicsMgr.debug().show()

    model2 = loader.loadModel('../../assets/models/chairs/mix_compound')

    model2.clearModelNodes()

    render.setRenderModeWireframe()

    #base.wireframeOff()

    # body2 = physicsMgr.getRigidBody()

    # body2.setMass(0)
Exemplo n.º 2
0
        [self.setShape(child,body) for child in children]  


""" ============================ TEST ============================ """

if __name__ == '__main__':

    from direct.directbase import DirectStart

    base.cam.setPos(0,-100,0)

    base.cam.lookAt(0,0,-10)

    from physicsmanager import PhysicsManager

    physicsMgr = PhysicsManager()

    physicsMgr.debug().show()

    '''Plane'''
    plane = physicsMgr.createRigidBody('plane', Vec3(0,0,1), pos=(0,0,-20) )

    props = {'mass':10}

    '''Primitive Shapes'''
    box = physicsMgr.createRigidBody('box', Vec3(3,3,3), props)

    np = render.attachNewNode(box)

    np.setPos(Vec3(20,0,0))
Exemplo n.º 3
0
		physicsMgr.addShape[shapetype](body,size)

	def addComplexShape(self,body,model,shapetype):
		geom = model.node().getGeom(0)
		physicsMgr.addShape[shapetype](body,geom)


"""Testing ---------------------------------------------"""

if __name__ == '__main__':

	from direct.directbase import DirectStart

	from physicsmanager import PhysicsManager

	physicsMgr = PhysicsManager()

	physicsMgr.debug().show()

	model2 = loader.loadModel('../../assets/models/chairs/mix_compound')

	model2.clearModelNodes()

	render.setRenderModeWireframe()

	#base.wireframeOff()

	# body2 = physicsMgr.getRigidBody()

	# body2.setMass(0)
Exemplo n.º 4
0
            child.reparentTo(np)

            self.setShape(child, body)

            physicsMgr.world.attachRigidBody(body)


""" ============================ TEST ============================ """

if __name__ == '__main__':

    from direct.directbase import DirectStart

    from physicsmanager import PhysicsManager

    physicsMgr = PhysicsManager()

    physicsMgr.debug().show()

    render.setRenderModeWireframe()

    model = loader.loadModel('../../assets/models/chairs/chair')

    composer = Composer()

    multi = 0

    if multi:
        composer.composeMulti(model)
    else:
        body = physicsMgr.getRigidBody()
Exemplo n.º 5
0
					self.shapes[shapetype[0]](child,shapetype[0])
					continue
				#child.reparentTo(model.getParent().getParent())
				#print "'%s' is not a name of a shapetype" % (shapetype[0])

		return True

"""----------------------------------------------"""

if __name__ == '__main__':

	from direct.directbase import DirectStart

	from physicsmanager import PhysicsManager

	physicsMgr = PhysicsManager()

	physicsMgr.debug().show()

	model = loader.loadModel('../../assets/models/chairs/mix_compound')

	model.clearModelNodes()

	render.setRenderModeWireframe()

	#base.wireframeOff()

	body = physicsMgr.getRigidBody()

	body.setMass(10)