Electric Motor Jbeam

I am trying to create an electric motor for the Bruckell LeGran in the game BeamNG.drive. For some reason, the code that I am using does not connect the motor to the rest of the drive train.

{
"egran_motor": {
    "information":{
        "authors":"BeamNG",
        "name":"Open Front Differential",
        "value":320,
    },
    "slotType" : "legran_engine",
    "slots": [
        ["type", "default", "description"],
        ["legran_halfshaft_F","legran_halfshaft_F", "Front Half Shafts"],
    ],
    "powertrain" : [
        ["type", "name", "inputName", "inputIndex"],
        ["electricMotor", "frontMotor", "dummy", 0],
        ["differential", "differential_F", "torsionReactorF", 1, {"diffType":"open", "gearRatio":1, "uiName":"Front Differential","defaultVirtualInertia":0.25}],
    ],
    "frontMotor":{
        "torque":[
            ["rpm", "torque"],
            [0,    12.05],
            [500,  12.03],
            [1000, 12.02],
            [1500, 12.03],
            [2000, 11.92],
            [2600, 11.0],
            [3000, 6.4],
            [3500, 2.0],
            [3700, 0.4],
           [4000, 0.1],

        ],

        "maxRPM":3700,
        "inertia":0.0005,
        "friction":0.5,
        "dynamicFriction":0.0003,
        "electricalEfficiency":0.95,
        "energyStorage": "mainBattery",
        "electricsThrottleFactorName": "throttleFactorFront",
        "maximumWantedRegenTorque": 300

        //node beam interface

        "uiName":"Front Motor",

        "soundConfig": "soundConfigFront",
    },
    "soundConfigFront": {
        "sampleName": "ElectricMotor_02",
        "mainGain": -4.5,
    },
    "vehicleController": {
        "shiftLogicName":"electricMotor",
        "motorNames": ["frontMotor"],
        "topSpeedLimitReverse": 15,
        "onePedalRegenCoef": 0.85
    },
    "differential_F": {
        "friction": 2.91,
        "dynamicFriction": 0.00128,
        "torqueLossCoef": 0.016,
    },
    "flexbodies": [
         ["mesh", "[group]:", "nonFlexMaterials"],
         //["legran_halfshaft_F", ["legran_halfshaft_F","legran_transmission","wheelhub_FR","wheelhub_FL","wheelhub_FR","wheelhub_FL"]],
    ],
    "nodes": [
         ["id", "posX", "posY", "posZ"],
         {"selfCollision":false},
         {"collision":true},
         {"nodeMaterial":"|NM_METAL"},
         {"frictionCoef":0.5},
         ["tra1", 0, -1.31, 0.29, {"nodeWeight":32, "group":""}],
    ],
    "beams": [
          ["id1:", "id2:"],
          {"beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0},
          {"beamSpring":4001000,"beamDamp":100},
          {"beamDeform":85000,"beamStrength":"FLT_MAX"},
          {"deformGroup":"differential_F", "deformationTriggerRatio":0.001},
          ["tra1","e1l"],
          ["tra1","e2l"],
          ["tra1","e4l"],
          ["tra1","e3l"],
          ["tra1","tra1l"],
          ["tra1","tra1r"],
          {"deformGroup":""},
    ],
},
"egran_fuelcell": {
    "information":{
        "authors":"BeamNG",
        "name":"Electric Fuel Cell",
        "value":340,
    },
    "slotType" : "legran_seats_R",
    "flexbodies": [
         ["mesh", "[group]:", "nonFlexMaterials"],
         ["legran_fuelcell", ["legran_body"],[], {"pos":{"x":0.15, "y":0.0, "z":0.0}}],
    ],
    "energyStorage": [
        ["type", "name"],
        ["electricBattery", "mainBattery"],
    ],
    "variables": [
        ["name", "type", "unit", "category", "default", "min", "max", "title", "description"],
        ["$fuel", "range", "kWh", "Chassis", 50, 0, 50, "Battery Level", "Initial battery charge", {"stepDis":0.5}],
    ],
    "mainBattery": {
        "energyType":"electricEnergy",
        "batteryCapacity": 50,
        "startingCapacity": "$fuel",
    },
    "nodes": [
         ["id", "posX", "posY", "posZ"],
         //fuel tank particles
         {"frictionCoef":1},
         {"collision":true},
         {"selfCollision":true},
         {"group":""},
         {"nodeWeight":0.5},
         {"engineGroup":["fuel"]},
         {"nodeMaterial":"|NM_PLASTIC"},
         {"chemEnergy":50,"burnRate":1.2,"flashPoint":220,"vaporPoint":97,"specHeat":0.03,"selfIgnitionCoef":0.06,"smokePoint":220,"containerBeam":"fuelTank"},
         ["ft1", -0.21, 0.83, 0.43],
         ["ft1l", -0.01, 0.83, 0.47],
         ["ft1r", -0.41, 0.83, 0.43],
         ["ft2l", -0.01, 0.7, 0.47],
         ["ft2r", -0.41, 0.7, 0.39],
         {"selfIgnitionCoef":false,"selfCollision":false},
         ["ft3", -0.21, 0.56, 0.39],
         ["ft3l", -0.01, 0.56, 0.47],
         ["ft3r", -0.41, 0.56, 0.42],
         {"chemEnergy":false,"burnRate":false,"flashPoint":false,"vaporPoint":false,"specHeat":false,"selfIgnitionCoef":false,"smokePoint":false,"containerBeam":false},
         {"engineGroup":""},
    ],
    "beams": [
          ["id1:", "id2:"],
          {"beamPrecompression":1, "beamType":"|NORMAL", "beamLongBound":1, "beamShortBound":1},
          {"beamSpring":240600,"beamDamp":100},
          {"beamDeform":3620,"beamStrength":31600},
          {"disableMeshBreaking":true,"disableTriangleBreaking":true},
          //connect fuel particles to tank
          {"deformLimitExpansion":""},
          ["ft1","f3r"],
          ["ft1","f4l"],
          ["ft1","f4r"],

          {"breakGroupType":1},
          {"breakGroup":"fueltank"},
          ["ft1l","f3r"],
          ["ft1l","f4l"],
          ["ft1l","f4r"],

          ["ft1r","f3r"],
          ["ft1r","f4l"],
          ["ft1r","f4r"],

          //["ft2","f3r"],
          //["ft2","f4l"],
          //["ft2","f4r"],

          ["ft2l","f3r"],
          ["ft2l","f4l"],
          ["ft2l","f4r"],

          ["ft2r","f3r"],
          ["ft2r","f4l"],
          ["ft2r","f4r"],

          ["ft3","f3r"],
          ["ft3","f4l"],
          ["ft3","f4r"],

          ["ft3l","f3r"],
          ["ft3l","f4l"],
          ["ft3l","f4r"],

          ["ft3r","f3r"],
          ["ft3r","f4l"],
          ["ft3r","f4r"],

          {"breakGroupType":0},
          {"beamSpring":100,"beamDamp":20},
          {"beamDeform":120,"beamStrength":160},
          {"optional":true},
          ["f8l", "f9r", {"name":"fuelTank","containerBeam": "fuelTank"}],
          ["f8r", "f9l"],
          ["f9l", "f9r"],
          ["f8r", "f8l"],
          ["f8l", "f9l"],
          ["f9r", "f8r"],
          {"optional":false},
          {"deformLimitExpansion":1.1},
          {"breakGroup":""},
          {"disableMeshBreaking":false,"disableTriangleBreaking":false},
    ],
}
}

I have tried to use the Vivace electric motor as a base but that seems to make the motor active but still not connected to the rest of the drive train.

Leave a Comment