Beispiel #1
0
 def genHand(self, handz=100.0):
     # fgr0
     boxx = 5.0
     boxy = 2.0
     boxz = 20.0
     boxpx = 0.0
     boxpy = 10.0
     boxpz = handz
     shape = BulletBoxShape(Vec3(boxx, boxy, boxz))  # the parameters are half extends
     node = BulletRigidBodyNode('fgr0')
     node.addShape(shape)
     node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
     self.bltWorld.attachRigidBody(node)
     pg.plotBox(self.base.render, pos=[boxpx, boxpy, boxpz], x=boxx * 2.0, y=boxy * 2.0, z=boxz * 2.0, rgba=None)
     # fgr1
     boxx = 5.0
     boxy = 2.0
     boxz = 20.0
     boxpx = 0.0
     boxpy = -10.0
     boxpz = handz
     shape = BulletBoxShape(Vec3(boxx, boxy, boxz))  # the parameters are half extends
     node = BulletRigidBodyNode('fgr1')
     node.addShape(shape)
     node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
     self.bltWorld.attachRigidBody(node)
     pg.plotBox(self.base.render, pos=[boxpx, boxpy, boxpz], x=boxx * 2.0, y=boxy * 2.0, z=boxz * 2.0, rgba=None)
Beispiel #2
0
 def addGround(self):
     boxx = 1000.0
     boxy = 1000.0
     boxz = 1.0
     offset=-55
     pg.plotBox(self.base.render, pos = [0,0,-1.0+offset], x = boxx*2.0, y = boxy*2.0, z = boxz*2.0, rgba=None)
     pg.plotAxisSelf(self.base.render)
     groundGeom = OdePlaneGeom(self.odespace, Vec4(0, 0, 1, offset))
Beispiel #3
0
 def addGround(self):
     boxx = 500.0
     boxy = 500.0
     boxz = 1.0
     shape = BulletBoxShape(Vec3(boxx, boxy, boxz)) # the parameters are half extends
     node = BulletRigidBodyNode('Ground')
     node.addShape(shape)
     self.bltWorld.attachRigidBody(node)
     pg.plotBox(self.base.render, pos = [0,0,-1.0], x = boxx*2.0, y = boxy*2.0, z = boxz*2.0, rgba=None)
Beispiel #4
0
 def addGround(self):
     boxx = 500.0
     boxy = 500.0
     boxz = 1.0
     pg.plotBox(self.base.render,
                pos=[0, 0, -1.0],
                x=boxx * 2.0,
                y=boxy * 2.0,
                z=boxz * 2.0,
                rgba=None)
     groundGeom = OdePlaneGeom(self.odespace, Vec4(0, 0, 1, 0))
Beispiel #5
0
 def addGround(self):
     boxx = 500.0
     boxy = 500.0
     boxz = 1.0
     shape = BulletBoxShape(Vec3(boxx, boxy,
                                 boxz))  # the parameters are half extends
     node = BulletRigidBodyNode('Ground')
     node.addShape(shape)
     self.bltWorld.attachRigidBody(node)
     pg.plotBox(self.base.render,
                pos=[0, 0, -1.0],
                x=boxx * 2.0,
                y=boxy * 2.0,
                z=boxz * 2.0,
                rgba=None)
Beispiel #6
0
 def genHand(self, handz=100.0):
     # fgr0
     boxx = 5.0
     boxy = 2.0
     boxz = 20.0
     boxpx = 0.0
     boxpy = 10.0
     boxpz = handz
     shape = BulletBoxShape(Vec3(boxx, boxy,
                                 boxz))  # the parameters are half extends
     node = BulletRigidBodyNode('fgr0')
     node.addShape(shape)
     node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
     self.bltWorld.attachRigidBody(node)
     pg.plotBox(self.base.render,
                pos=[boxpx, boxpy, boxpz],
                x=boxx * 2.0,
                y=boxy * 2.0,
                z=boxz * 2.0,
                rgba=None)
     # fgr1
     boxx = 5.0
     boxy = 2.0
     boxz = 20.0
     boxpx = 0.0
     boxpy = -10.0
     boxpz = handz
     shape = BulletBoxShape(Vec3(boxx, boxy,
                                 boxz))  # the parameters are half extends
     node = BulletRigidBodyNode('fgr1')
     node.addShape(shape)
     node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
     self.bltWorld.attachRigidBody(node)
     pg.plotBox(self.base.render,
                pos=[boxpx, boxpy, boxpz],
                x=boxx * 2.0,
                y=boxy * 2.0,
                z=boxz * 2.0,
                rgba=None)
Beispiel #7
0
    def addWalls(self):
        """
        add walls

        :return:
        """

        # x+
        boxx = 2.0
        boxy = 50.0
        boxz = 100.0
        boxpx = 50.0
        boxpy = 0.0
        boxpz = 50.0
        shape = BulletBoxShape(Vec3(boxx, boxy,
                                    boxz))  # the parameters are half extends
        node = BulletRigidBodyNode('Wallx+')
        node.addShape(shape)
        node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
        self.bltWorld.attachRigidBody(node)
        pg.plotBox(self.base.render,
                   pos=[boxpx, boxpy, boxpz],
                   x=boxx * 2.0,
                   y=boxy * 2.0,
                   z=boxz * 2.0,
                   rgba=None)
        # x-
        boxx = 2.0
        boxy = 50.0
        boxz = 100.0
        boxpx = -50.0
        boxpy = 0.0
        boxpz = 50.0
        shape = BulletBoxShape(Vec3(boxx, boxy,
                                    boxz))  # the parameters are half extends
        node = BulletRigidBodyNode('Wallx-')
        node.addShape(shape)
        node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
        self.bltWorld.attachRigidBody(node)
        pg.plotBox(self.base.render,
                   pos=[boxpx, boxpy, boxpz],
                   x=boxx * 2.0,
                   y=boxy * 2.0,
                   z=boxz * 2.0,
                   rgba=None)
        # y+
        boxx = 50.0
        boxy = 2.0
        boxz = 100.0
        boxpx = 0.0
        boxpy = 50.0
        boxpz = 50.0
        shape = BulletBoxShape(Vec3(boxx, boxy,
                                    boxz))  # the parameters are half extends
        node = BulletRigidBodyNode('Wally+')
        node.addShape(shape)
        node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
        self.bltWorld.attachRigidBody(node)
        pg.plotBox(self.base.render,
                   pos=[boxpx, boxpy, boxpz],
                   x=boxx * 2.0,
                   y=boxy * 2.0,
                   z=boxz * 2.0,
                   rgba=None)
        # y-
        boxx = 50.0
        boxy = 2.0
        boxz = 100.0
        boxpx = 0.0
        boxpy = -50.0
        boxpz = 50.0
        shape = BulletBoxShape(Vec3(boxx, boxy,
                                    boxz))  # the parameters are half extends
        node = BulletRigidBodyNode('Wally-')
        node.addShape(shape)
        node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
        self.bltWorld.attachRigidBody(node)
        pg.plotBox(self.base.render,
                   pos=[boxpx, boxpy, boxpz],
                   x=boxx * 2.0,
                   y=boxy * 2.0,
                   z=boxz * 2.0,
                   rgba=None)

        # shape = BulletPlaneShape(Vec3(0, 0, 1), 0.0)
        # node = BulletRigidBodyNode('Ground')
        # node.addShape(shape)
        # np = self.base.render.attachNewNode(node)
        # np.setPos(0, 0, 0)
        # self.bltWorld.attachRigidBody(node)
        self.handz = 200.0
Beispiel #8
0
 def addGround(self):
     boxx = 500.0
     boxy = 500.0
     boxz = 1.0
     pg.plotBox(self.base.render, pos = [0,0,-1.0], x = boxx*2.0, y = boxy*2.0, z = boxz*2.0, rgba=None)
     groundGeom = OdePlaneGeom(self.odespace, Vec4(0, 0, 1, 0))
Beispiel #9
0
    def addWalls(self):
        """
        add walls

        :return:
        """

        # x+
        boxx = 2.0
        boxy = 50.0
        boxz = 100.0
        boxpx = 50.0
        boxpy = 0.0
        boxpz = 50.0
        shape = BulletBoxShape(Vec3(boxx, boxy, boxz)) # the parameters are half extends
        node = BulletRigidBodyNode('Wallx+')
        node.addShape(shape)
        node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
        self.bltWorld.attachRigidBody(node)
        pg.plotBox(self.base.render, pos = [boxpx, boxpy, boxpz], x = boxx*2.0, y = boxy*2.0, z = boxz*2.0, rgba=None)
        # x-
        boxx = 2.0
        boxy = 50.0
        boxz = 100.0
        boxpx = -50.0
        boxpy = 0.0
        boxpz = 50.0
        shape = BulletBoxShape(Vec3(boxx, boxy, boxz)) # the parameters are half extends
        node = BulletRigidBodyNode('Wallx-')
        node.addShape(shape)
        node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
        self.bltWorld.attachRigidBody(node)
        pg.plotBox(self.base.render, pos = [boxpx, boxpy, boxpz], x = boxx*2.0, y = boxy*2.0, z = boxz*2.0, rgba=None)
        # y+
        boxx = 50.0
        boxy = 2.0
        boxz = 100.0
        boxpx = 0.0
        boxpy = 50.0
        boxpz = 50.0
        shape = BulletBoxShape(Vec3(boxx, boxy, boxz))  # the parameters are half extends
        node = BulletRigidBodyNode('Wally+')
        node.addShape(shape)
        node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
        self.bltWorld.attachRigidBody(node)
        pg.plotBox(self.base.render, pos=[boxpx, boxpy, boxpz], x=boxx * 2.0, y=boxy * 2.0, z=boxz * 2.0, rgba=None)
        # y-
        boxx = 50.0
        boxy = 2.0
        boxz = 100.0
        boxpx = 0.0
        boxpy = -50.0
        boxpz = 50.0
        shape = BulletBoxShape(Vec3(boxx, boxy, boxz))  # the parameters are half extends
        node = BulletRigidBodyNode('Wally-')
        node.addShape(shape)
        node.setTransform(TransformState.makePos(VBase3(boxpx, boxpy, boxpz)))
        self.bltWorld.attachRigidBody(node)
        pg.plotBox(self.base.render, pos=[boxpx, boxpy, boxpz], x=boxx * 2.0, y=boxy * 2.0, z=boxz * 2.0, rgba=None)

        # shape = BulletPlaneShape(Vec3(0, 0, 1), 0.0)
        # node = BulletRigidBodyNode('Ground')
        # node.addShape(shape)
        # np = self.base.render.attachNewNode(node)
        # np.setPos(0, 0, 0)
        # self.bltWorld.attachRigidBody(node)
        self.handz = 200.0