Beispiel #1
0
                  file=jsonfile)
            if b.name == 'Hull':
                print('\t\t"InitialForceScale" : ' +
                      str(20 * raptor_walker.INITIAL_RANDOM) + ',',
                      file=jsonfile)
            else:
                print('\t\t"InitialForceScale" : 0,', file=jsonfile)
            print('\t\t"Depth" : ' + str(b.depth), file=jsonfile)
            print('\t},', file=jsonfile)

        # Write joints
        for i, jnt in enumerate(joints):
            bA = jnt.bodyA.userData
            bB = jnt.bodyB.userData
            # Convert anchors into local space
            anchorA = Box2D.b2Rot(-bA.angle) * (jnt.anchorA - bA.position)
            anchorB = Box2D.b2Rot(-bB.angle) * (jnt.anchorB - bB.position)
            anchorA = [anchorA[i] * S for i in range(2)]
            anchorB = [anchorB[i] * S for i in range(2)]
            a = bA._tmp_index
            b = bB._tmp_index
            #lowerLimit = jnt.lowerLimit
            #upperLimit = jnt.upperLimit
            lowerLimit = lower_limits[i]
            upperLimit = upper_limits[i]
            print('\t"Joint' + str(i) + '.' + bA.name + '.' + bB.name +
                  '" : {',
                  file=jsonfile)
            print('\t\t"DataType" : "JointMotor",', file=jsonfile)
            print('\t\t"BodyA" : "' + bA.name + '",', file=jsonfile)
            print('\t\t"BodyB" : "' + bB.name + '",', file=jsonfile)