Esempio n. 1
0
    def mouseJoint(self, body, pos):
        pos = self.parent.to_world(pos)
        x, y = pos
        x /= self.parent.ppm
        y /= self.parent.ppm

        mj = box2d.b2MouseJointDef()
        mj.body1 = self.parent.world.GetGroundBody()
        mj.body2 = body
        mj.target = box2d.b2Vec2(x, y)
        mj.maxForce = 100.0 * body.GetMass() # give humans POWER!
        self.parent.mouseJoint = self.parent.world.CreateJoint(mj).getAsType()
        body.WakeUp()
Esempio n. 2
0
    def mouseJoint(self, body, pos, jointForce=100.0):
        pos = self.parent.to_world(pos)
        x, y = pos
        x /= self.parent.ppm
        y /= self.parent.ppm

        mj = box2d.b2MouseJointDef()
        mj.body1 = self.parent.world.GetGroundBody()
        mj.body2 = body
        mj.target = (x, y)
        mj.maxForce = jointForce * body.GetMass()
        self.parent.mouseJoint = self.parent.world.CreateJoint(mj).getAsType()
        body.WakeUp()
Esempio n. 3
0
    def mouseJoint(self, body, pos, jointForce=100.0):
        pos = self.parent.to_world(pos)
        x, y = pos
        x /= self.parent.ppm
        y /= self.parent.ppm

        mj = box2d.b2MouseJointDef()
        mj.bodyA = self.parent.world.groundBody
        mj.bodyB = body
        mj.target = (x, y)
        mj.maxForce = jointForce * body.mass
        if 'getAsType' in dir(box2d.b2Joint):
            self.parent.mouseJoint = \
                self.parent.world.CreateJoint(mj).getAsType()
        else:
            self.parent.mouseJoint = self.parent.world.CreateJoint(mj)
        body.awake = True
Esempio n. 4
0
    def mouseJoint(self, body, pos, jointForce=100.0):
        pos = self.parent.to_world(pos)
        x, y = pos
        x /= self.parent.ppm
        y /= self.parent.ppm

        mj = box2d.b2MouseJointDef()
        mj.bodyA = self.parent.world.groundBody
        mj.bodyB = body
        mj.target = (x, y)
        mj.maxForce = jointForce * body.mass
        if 'getAsType' in dir(box2d.b2Joint):
            self.parent.mouseJoint = \
                self.parent.world.CreateJoint(mj).getAsType()
        else:
            self.parent.mouseJoint = self.parent.world.CreateJoint(mj)
        body.awake = True
Esempio n. 5
0
    def mouseJoint(self, body, pos, jointForce=100.0):
        pos = self.parent.to_world(pos)
        x, y = pos
        x /= self.parent.ppm
        y /= self.parent.ppm

        mj = box2d.b2MouseJointDef()
        mj.body1 = self.parent.world.GetGroundBody()
        mj.body2 = body
        mj.target = (x, y)
        mj.maxForce = jointForce * body.GetMass()
        if 'getAsType' in dir(box2d.b2Joint):
            self.parent.mouseJoint = \
                self.parent.world.CreateJoint(mj).getAsType()
        else:
            self.parent.mouseJoint = self.parent.world.CreateJoint(mj)
        body.WakeUp()