{
"s4b8_trunk": {
    "information":{
        "authors":"BeamNG",
        "name":"Trunk",
        "value":410,
    },
    "slotType" : "s4b8_trunk",
    "slots": [
        ["type", "default", "description"],
        ["s4b8_lettering_trunk_L","", "Left Lettering"],
        ["s4b8_lettering_trunk_R","", "Right Lettering"],
        ["s4b8_spoiler_sedan","","Spoiler"],
        ["s4b8_licenseplate_R","","License Plate"],
        ["s4b8_lettering_trunk","","Audi Logo"],
        ["s4b8_trunk_lights","","Trunk lights"],
        ["s4b8_plateholder_R","","Plateholder"],
        ["s4b8_gopro","","Go Pro"],
        ["s4b8_antennas","","Police Antennas"],
    ],
    "flexbodies": [
        ["mesh", "[group]:", "nonFlexMaterials"],
        ["s4b8_trunk_sedan", ["s4b8_trunk"]],
    ],
    "controller": [
        ["fileName"],
        ["advancedCouplerControl", {"name":"trunkCoupler"}],
    ]
    "trunkCoupler":{
        "groupType": "autoCoupling",
        "couplerNodes":[
            ["cid1",    "cid2",     "autoCouplingStrength",    "autoCouplingRadius",   "autoCouplingLockRadius",   "autoCouplingSpeed", "couplingStartRadius",  "breakGroup"]
            ["r7",      "t7",        40000,                     0.01,                   0.005,                      0.2,                 0.2,                   "tailgate_latch", {"forceCid1":"t7", "forceCid2":"t4"}]
        ]
        "attachSoundVolume":1,
        "detachSoundVolume":1,
        "soundNode:":["r5"]
        "attachSoundEvent": "event:>Vehicle>Latches>Trunk>modern_02_close",
        "detachSoundEvent": "event:>Vehicle>Latches>Trunk>90s_04_open",
        "breakSoundEvent":""
        "openForceMagnitude": 20,
        "openForceDuration": 0.5,
        "closeForceMagnitude": 60,
        "closeForceDuration": 3.5,
    }
    "triggers2":[
        ["id", "idRef:", "idX:", "idY:", "type", "size", "baseRotation", "rotation", "translation", "baseTranslation"],
        ["tailgate", "t4","t4r","t3", "box", {"x":0.1, "y":0.08, "z":0.08}, {"x":0, "y":0, "z":-3}, {"x":0, "y":0, "z":0}, {"x":0, "y":0, "z":0}, {"x":-0.05, "y":0.12, "z":-0.06}],
        ["tailgate_int", "t4","t4r","t3", "box", {"x":0.12, "y":0.06, "z":0.06}, {"x":0, "y":0, "z":-3}, {"x":0, "y":0, "z":0}, {"x":0, "y":0, "z":0}, {"x":-0.06, "y":0.0, "z":0.06}],
    ],
    "actionsEnabled": [
        ["id"],
        ["trunk"],
    ],
    "triggerEventLinks2":[
        ["triggerId:triggers2", "triggerInput", "inputAction"],
        ["tailgate", "action0", "trunk"],
        ["tailgate_int", "action0", "trunk"],
    ],
    "props": [
        ["func", "mesh", "idRef:", "idX:", "idY:", "baseRotation", "rotation", "translation", "min", "max", "offset", "multiplier"],
        {
            "lightInnerAngle":0,
            "lightOuterAngle":120,
            "lightRange":8,
            "lightColor":{"r":255, "g":10, "b":0, "a":255},
            "lightAttenuation":{"x":0, "y":1, "z":1},
            "lightCastShadows":false,
            "flareName":"vehicleBrakeLightFlare",
        },
        //taillights
        ["lowhighBrake_filament" ,         "SPOTLIGHT"        , "t4r", "t4rr", "t3r", {"x":200, "y":0, "z":0} , {"x":0, "y":0, "z":0}    , {"x":0, "y":0, "z":0}, 0, 0, 0, 1, {"baseTranslation":{"x":0.80, "y":0.55, "z":0.02},"flareScale":0.05,"lightBrightness":0.08,"deformGroup":"tailgatelight_R_break","lightScaling":{}}],
        ["lowhighBrake_filament" ,         "SPOTLIGHT"        , "t4l", "t4ll", "t3l", {"x":-20, "y":0, "z":0} , {"x":0, "y":0, "z":0}    , {"x":0, "y":0, "z":0}, 0, 0, 0, 1, {"baseTranslation":{"x":0.70, "y":0.55, "z":-0.055},"flareScale":0.015,"lightBrightness":0.08,"deformGroup":"tailgatelight_L_break","lightScaling":{}}],
        ["foglight_filament" ,             "SPOTLIGHT"        , "t4l", "t4ll", "t3l", {"x":-20, "y":0, "z":0} , {"x":0, "y":0, "z":0}    , {"x":0, "y":0, "z":0}, 0, 0, 0, 1, {"baseTranslation":{"x":1.0, "y":0.37, "z":-0.02},"flareScale":0.06,"lightBrightness":0.2,"deformGroup":"tailgatelight_L_break","lightScaling":{}}],

        {
            "lightInnerAngle":0,
            "lightOuterAngle":120,
            "lightRange":8,
            "lightColor":{"r":255, "g":255, "b":200, "a":255},
            "lightAttenuation":{"x":0, "y":1, "z":1},
            "lightCastShadows":false,
            "flareName":"vehicleReverseLightFlare",
            "cookieName":"art/special/BNG_light_cookie_headlight.dds"
            "texSize":512,
            "shadowSoftness":0.5,
        },
        ["reverse" ,         "SPOTLIGHT"        , "t4r", "t4rr", "t3r", {"x":200, "y":0, "z":0} , {"x":0, "y":0, "z":0}    , {"x":0, "y":0, "z":0}, 0, 0, 0, 1, {"baseTranslation":{"x":0.9, "y":0.37, "z":0.02},"flareScale":0.05,"lightBrightness":0.06,"deformGroup":"tailgatelight_R_break"}],
        ["reverse" ,         "SPOTLIGHT"        , "t4l", "t4ll", "t3l", {"x":-20, "y":0, "z":0} , {"x":0, "y":0, "z":0}    , {"x":0, "y":0, "z":0}, 0, 0, 0, 1, {"baseTranslation":{"x":0.9, "y":0.37, "z":-0.02},"flareScale":0.05,"lightBrightness":0.06,"deformGroup":"tailgatelight_L_break"}],
    ],
    "nodes": [
        ["id", "posX", "posY", "posZ"],
         //--trunk--
         {"collision":true},
         {"selfCollision":true},
         {"nodeMaterial":"|NM_METAL"},
         {"frictionCoef":0.5},
         {"group":"s4b8_trunk"},
         {"nodeWeight":1.6},
         ["t1r", -0.595, 1.765, 1.063],
         ["t1", 0, 1.911, 1.06],
         ["t1l", 0.595, 1.765, 1.063],

         ["t3rr", -0.605, 2.15, 0.99],
         ["t3r", -0.32, 2.22, 1.02],
         ["t3", 0.0, 2.235, 1.03],
         ["t3l", 0.32, 2.22, 1.02],
         ["t3ll", 0.605, 2.15, 0.99],

         ["t4rr", -0.585, 2.25, 0.71],
         ["t4r", -0.30, 2.29, 0.71],
         ["t4", 0.0, 2.30, 0.71],
         ["t4l", 0.30, 2.29, 0.71],
         ["t4ll", 0.585, 2.25, 0.71],
         //trunk hinge
         {"collision":true},
         {"selfCollision":false},
         {"group":""},
         {"nodeWeight":1.0},
         ["th1r", -0.595, 1.655, 1.03],
         ["th1l",  0.595, 1.655, 1.03],
         //springs attache
         {"nodeWeight":0.8},
         ["th2r", -0.595, 1.60, 0.97],
         ["th2l",  0.595, 1.60, 0.97],

         //rigidifier
         {"collision":false},
         {"selfCollision":false},
         {"nodeWeight":2},
         ["t5", 0, 1.97, 0.83],
         {"group":""},

         //latch node
         {"nodeWeight":1.6},
         ["t7", -0.0, 2.31, 0.58],
    ],
    "beams": [
          ["id1:", "id2:"],
          //--trunk--
          {"beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0},
          {"beamSpring":1201000,"beamDamp":100},
          {"beamDeform":32550,"beamStrength":"FLT_MAX"},
          //trunk main shape
          {"deformLimitExpansion":1.1},
          {"deformationTriggerRatio":0.05},
          {"deformGroup":"tailgatelight_R_break"},
          ["t3rr","t3r"],
          ["t4rr","t4r"],
          ["t3rr","t4rr"],
          ["t3r","t4r"],
          {"deformGroup":"tailgatelight_L_break"},
          ["t3l","t3ll"],
          ["t4l","t4ll"],
          ["t3l","t4l"],
          ["t3ll","t4ll"],
          {"deformGroup":""},
          ["t3r","t3"],
          ["t3l","t3"],
          ["t4r","t4"],
          ["t4l","t4"],
          ["t3","t4"],
          ["t3ll", "t1l"],
          ["t3", "t1"],
          ["t3rr", "t1r"],
          ["t1r", "t1"],
          ["t1", "t1l"],

          //surficial crossing
          {"deformLimitExpansion":""},
          {"beamDeform":14550,"beamStrength":"FLT_MAX"},
          {"deformGroup":"tailgatelight_R_break"},
          ["t4rr","t3r"],
          ["t4r","t3rr"],
          {"deformGroup":"tailgatelight_L_break"},
          ["t4l","t3ll"],
          ["t4ll","t3l"],
          {"deformGroup":""},
          ["t4r","t3"],
          ["t4","t3r"],
          ["t4l","t3"],
          ["t4","t3l"],
          ["t3", "t1l"],
          ["t3ll", "t1"],
          ["t3l", "t1l"],
          ["t3l", "t1"],
          ["t3r", "t1"],
          ["t3r", "t1r"],
          ["t3", "t1r"],
          ["t3rr", "t1"],

          //rigids
          {"beamSpring":801000,"beamDamp":120},
          {"beamDeform":5550,"beamStrength":"FLT_MAX"},
          {"deformGroup":"tailgatelight_R_break"},
          ["t4rr","t4"],
          ["t3rr","t3"],
          {"deformGroup":"tailgatelight_L_break"},
          ["t4","t4ll"],
          ["t3","t3ll"],
          {"deformGroup":""},
          ["t3r","t3l"],
          ["t4r","t4l"],
          {"beamDeform":3550,"beamStrength":"FLT_MAX"},
          ["t1", "t4"],
          ["t1", "t4r"],
          ["t1", "t4l"],
          ["t1r", "t4rr"],
          ["t1r", "t4r"],
          ["t1l", "t4ll"],
          ["t1l", "t4l"],

          //rigidifier
          {"beamSpring":1751000,"beamDamp":150},
          {"beamDeform":5000,"beamStrength":"FLT_MAX"},
          {"deformationTriggerRatio":0.05},
          {"deformGroup":"tailgatelight_R_break"},
          ["t3rr","t5"],
          ["t3r","t5"],
          ["t4rr","t5"],
          ["t4r","t5"],
          {"deformGroup":"tailgatelight_L_break"},
          ["t3l","t5"],
          ["t3ll","t5"],
          ["t4l","t5"],
          ["t4ll","t5"],
          {"deformGroup":""},
          ["t5", "t1"],
          ["t5", "t1r"],
          ["t5", "t1l"],
          ["t3","t5"],
          ["t4","t5"],

          //latch node
          ["t7", "t3"],
          ["t7", "t3r"],
          ["t7", "t3l"],
          ["t7", "t4"],
          ["t7", "t4r"],
          ["t7", "t4l"],
          ["t7", "t5"],

          //hinge spring nodes to trunk
          {"beamSpring":751000,"beamDamp":50},
          {"beamDeform":5000,"beamStrength":"FLT_MAX"},
          ["th2r","t1l"],
          ["th2r","t1"],
          ["th2r","t3l"],
          ["th2r","t3ll"],
          ["th2r","t4ll"],
          ["th2r","t5"],

          ["th2l","t1l"],
          ["th2l","t1"],
          ["th2l","t3l"],
          ["th2l","t3ll"],
          ["th2l","t4ll"],
          ["th2l","t5"],

          //trunk hinge node to body
          {"beamSpring":2501000,"beamDamp":150},
          {"beamDeform":14000,"beamStrength":"FLT_MAX"},
          ["th1l", "tb1l"],
          ["th1l", "p10l"],
          ["th1l", "tb1"],
          ["th1l", "q7l"],
          ["th1l", "r5ll"],

          ["th1r", "tb1r"],
          ["th1r", "p10r"],
          ["th1r", "tb1"],
          ["th1r", "q7r"],
          ["th1r", "r5rr"],

          //trunk hinge break
          {"beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0},
          {"beamSpring":301000,"beamDamp":100},
          {"beamDeform":15000,"beamStrength":65000},
          //r
          {"breakGroup":"trunkhinge_R"},
          {"deformGroup":"trunklight_R_break"},
          ["t1r", "th1r"],
          ["t1", "th1r"],
          ["t3r", "th1r"],
          ["t3rr", "th1r"],
          ["t5", "th1r"],
          ["th2r", "th1r"],

          //l
          {"breakGroup":"trunkhinge_L"},
          {"deformGroup":"trunklight_L_break"},
          ["t1l", "th1l"],
          ["t1", "th1l"],
          ["t3l", "th1l"],
          ["t3ll", "th1l"],
          ["t5", "th1l"],
          ["th2l", "th1l"],
          {"breakGroup":""},

          {"breakGroup":""},
          {"deformGroup":""},

          //trunk latch
          {"beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0},
          {"beamSpring":2001000,"beamDamp":120},
          {"beamDeform":9000,"beamStrength":22000},
          {"breakGroup":"trunklatch"},
          //["t4","r7"],
          //["t4r","r7"],
          //["t4l","r7"],
          //["t4r","r7rr"],
          //["t4","r7rr"],
          //["t4","r7ll"],
          //["t4l","r7ll"],
          //["t5","r7rr"],
          //["t5","r7"],
          //["t5","r7ll"],
          {"breakGroup":""},

          //pop open
          {"breakGroupType":1},
          {"beamType":"|SUPPORT", "beamLongBound":4},
          {"beamSpring":7000,"beamDamp":200},
          {"beamDeform":4000,"beamStrength":10000},
          {"beamPrecompression":1.03},
          ["t4l", "r6", {"breakGroup":"trunkhinge_R"}],
          ["t4r", "r6", {"breakGroup":"trunkhinge_L"}],

          //gas struts
          {"beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0},
          {"breakGroupType":1},
          {"beamSpring":4900,"beamDamp":200},
          {"beamDeform":4000,"beamStrength":10000},
          {"beamPrecompression":0.55},
          ["th2r", "q4r", {"breakGroup":"trunkhinge_R"}],
          ["th2l", "q4l", {"breakGroup":"trunkhinge_L"}],
          {"beamPrecompression":1},
          {"breakGroupType":0},
          {"breakGroup":""},

          //damping
          {"beamDeform":27600,"beamStrength":225000},
          {"beamSpring":0,"beamDamp":350},
          ["th2r", "q4r", {"breakGroup":"trunkhinge_R", "dampCutoffHz":500}],
          ["th2l", "q4l", {"breakGroup":"trunkhinge_L", "dampCutoffHz":500}],
          {"breakGroup":""},

          //limiter
          {"beamType":"|SUPPORT", "beamLongBound":14.0, "beamShortBound":1.0},
          {"beamDeform":27600,"beamStrength":225000},
          {"beamSpring":155000,"beamDamp":300},
          {"beamPrecompression":0.82},
          {"boundZone":0.1},
          ["th2r", "q4r", {"breakGroup":"trunkhinge_R"}],
          ["th2l", "q4l", {"breakGroup":"trunkhinge_L"}],
          {"boundZone":0.05},
          {"beamPrecompression":0.65},
          {"beamSpring":100,"beamDamp":3400},
          ["th2r", "tb1r", {"breakGroup":"trunkhinge_R", "dampCutoffHz":1500}],
          ["th2l", "tb1l", {"breakGroup":"trunkhinge_L", "dampCutoffHz":1500}],
          //dampening end of stroke
          {"beamDeform":27600,"beamStrength":225000},
          {"beamSpring":3000,"beamDamp":2400},
          {"beamPrecompression":0.97},
          {"boundZone":0.1},
          ["th2r", "r4rr", {"breakGroup":"trunkhinge_R", "dampCutoffHz":500}],
          ["th2l", "r4ll", {"breakGroup":"trunkhinge_L", "dampCutoffHz":500}],
          {"breakGroup":""},
          {"boundZone":""},

          //trunk support beams
          {"beamType":"|SUPPORT", "beamLongBound":15},
          {"beamSpring":1001000,"beamDamp":50},
          {"beamDeform":7500,"beamStrength":230000},
          {"breakGroup":"trunk_supportBeams"},
          {"beamPrecompression":1.00},
          ["t3rr","q4r"],
          ["t3ll","q4l"],
          {"beamLongBound":6},
          ["t3rr","q9r"],
          ["t3ll","q9l"],

          ["t4r","q9r"],
          ["t4l","q9l"],

          ["t4rr","r4rr"],
          ["t4ll","r4ll"],

          ["t4rr","r3rr"],
          ["t4ll","r3ll"],

          ["t3","r7"],
          ["t3r","r7"],
          ["t3l","r7"],
          ["t3r","r7rr"],
          ["t3l","r7ll"],

         // ["t1r", "tb1r"],
         // ["t1r", "q9r"],
         // ["t1r", "q2r"],
         // ["t1r", "p10r"],
         // ["t1r", "q1r"],
        //
        // ["t1l", "tb1l"],
        // ["t1l", "q9l"],
        // ["t1l", "q2l"],
        // ["t1l", "p10l"],
        // ["t1l", "q1l"],
          {"optional":false},
          {"breakGroup":""},
          {"beamPrecompression":1, "beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0},
          {"deformLimitExpansion":1.1},
    ],
    "triangles": [
            ["id1:","id2:","id3:"],
            //trunk
            {"groundModel":"metal"},
            {"group":"s4b8_trunk"},
            {"dragCoef":7},
            ["t3ll", "t3l", "t1l"],
            ["t3r", "t3rr", "t1r"],
            ["t1", "t3", "t3r"],
            ["t1", "t3l", "t3"],
            ["t1l", "t3l", "t1"],
            ["t1", "t3r", "t1r"],

            {"dragCoef":10.5},
            ["t3ll","t4ll","t4l"],
            ["t3ll","t4l","t3l"],
            ["t3l","t4","t3"],
            ["t3l","t4l","t4"],
            ["t4r","t3r","t4"],
            ["t3r","t3","t4"],
            ["t3r","t4r","t3rr"],
            ["t4rr","t3rr","t4r"],

    ],
},
}
