{
"MG7KEN_trunk": {
    "information":{
        "authors":"Kenemation",
        "name":"Trunk",
        "value":410,
    },
    "slotType" : "MG7KEN_trunk",
    "slots": [
        ["type", "default", "description"],
        ["MG7KEN_lettering_84x","MG7KEN_lettering_trunk_844", "Trunk Lettering"],
        ["MG7KEN_spoiler_sedan","","Spoiler"],
        ["MG7KEN_trglass","","Trunk Glass"],
    ],
    "flexbodies": [
        ["mesh", "[group]:", "nonFlexMaterials"],
        ["MG7KEN_trunk", ["MG7KEN_trunk"]],
        {"deformGroup":"tailgatelight_L_break", "deformMaterialBase":"MG7KEN_lights", "deformMaterialDamaged":"mg7ken_taillightmesh"},
        ["MG7KEN_tailgatelight_L", ["MG7KEN_trunk"],[]{"deformSound":"event:>Destruction>Vehicle>Glass>glassbreaksound3", "deformVolume":0.3}],
        {"deformGroup":"tailgatelight_R_break", "deformMaterialBase":"MG7KEN_lights", "deformMaterialDamaged":"mg7ken_taillightmesh"},
        ["MG7KEN_tailgatelight_R", ["MG7KEN_trunk"],[]{"deformSound":"event:>Destruction>Vehicle>Glass>glassbreaksound4", "deformVolume":0.3}],

        {"deformGroup":"tailgatelight_L_break", "deformMaterialBase":"MG7KEN_glass", "deformMaterialDamaged":"MG7KEN_glass_dmg"},
        ["MG7KEN_tailgatelightglass_L", ["MG7KEN_trunk"]],
        {"deformGroup":"tailgatelight_R_break", "deformMaterialBase":"MG7KEN_glass", "deformMaterialDamaged":"MG7KEN_glass_dmg"},
        ["MG7KEN_tailgatelightglass_R", ["MG7KEN_trunk"]],
        {"deformGroup":""},
    ],
    "controller": [
        ["fileName"],
        ["advancedCouplerControl", {"name":"tailgateCoupler"}],
    ]
    "tailgateCoupler":{
        "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": 2.5,
        "closeForceMagnitude": 120,
        "closeForceDuration": 3.5,
    }
    "triggers":[
        ["id", "label", "idRef:", "idX:", "idY:", "type", "size", "baseRotation", "rotation", "translation", "baseTranslation"],
        ["tailgate", "", "t4","t4r","t3", "box", {"x":0.1, "y":0.08, "z":0.08}, {"x":17, "y":0, "z":-3.5}, {"x":0, "y":0, "z":0}, {"x":0, "y":0, "z":0}, {"x":-0.05, "y":0.28, "z":-0.00}],
        ["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}],
    ],
    "triggerEventLinks":[
        ["triggerId:triggers", "action", "targetEventId:events"],
        ["tailgate", "action0", "tailgateLatch"],
        ["tailgate_int", "action0", "tailgateLatch"],
    ],
    "events":[
        ["id", "title", "desc"],
        ["tailgateLatch", "ui.inputActions.common.tailgateLatch.title", "ui.inputActions.common.tailgateLatch.description", {"onUp":"controller.getControllerSafe('tailgateCoupler').toggleGroup()"}],
    ],
    "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
        ["brakelights" ,         "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.0,"lightBrightness":0.08,"deformGroup":"tailgatelight_R_break"}],
        ["brakelights" ,         "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.80, "y":0.55, "z":-0.02},"flareScale":0.0,"lightBrightness":0.08,"deformGroup":"tailgatelight_L_break"}],
        ["lowhighbeam" ,         "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.70, "y":0.55, "z":0.055},"flareScale":0.0,"lightBrightness":0.08,"deformGroup":"tailgatelight_R_break"}],
        ["lowhighbeam" ,         "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.0,"lightBrightness":0.08,"deformGroup":"tailgatelight_L_break"}],
        ["fog" ,                 "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.0,"lightBrightness":0.2,"deformGroup":"tailgatelight_L_break"}],

        {
            "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.0,"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.0,"lightBrightness":0.06,"deformGroup":"tailgatelight_L_break"}],
    ],
    "nodes": [
        ["id", "posX", "posY", "posZ"],
         //--trunk--
         {"collision":true},
         {"selfCollision":true},
         {"nodeMaterial":"|NM_METAL"},
         {"frictionCoef":0.5},
         {"group":"MG7KEN_trunk"},
         {"nodeWeight":1.6},
         ["t1r", -0.5397, 1.3327, 1.3113],
         ["t1", 0.0000, 1.3405, 1.3379],
         ["t1l", 0.5397, 1.3327, 1.3113],

         ["t3rr", -0.6072, 2.2339, 0.9928],
         ["t3r", -0.32, 2.3803, 1.0344],
         ["t3", 0.0000, 2.3953, 1.0444],
         ["t3l", 0.32, 2.3803, 1.0344],
         ["t3ll", 0.6072, 2.2339, 0.9928],

         ["t4rr", -0.4576, 2.3881, 0.6826],
         ["t4r", -0.30, 2.42, 0.671],
         ["t4", 0.0000, 2.4446, 0.671],
         ["t4l", 0.30, 2.42, 0.671],
         ["t4ll", 0.4576, 2.3881, 0.6826],
         //trunk hinge
         {"collision":true},
         {"selfCollision":false},
         {"group":""},
         {"nodeWeight":1.0},
         ["th1r", -0.4356, 1.2206, 1.2775],
         ["th1l",  0.4356, 1.2206, 1.2775],
         //springs attache
         {"nodeWeight":0.8},
         ["th2r", -0.5011, 1.3574, 1.0254],
         ["th2l",  0.5011, 1.3574, 1.0254],

         //rigidifier
         {"collision":false},
         {"selfCollision":false},
         {"nodeWeight":2},
         ["t5", -0.0000, 1.9588, 0.9156],
         {"group":""},

         //latch node
         {"nodeWeight":1.6},
         ["t7", 0.0000, 2.4546, 0.541],
    ],
    "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"},
         {"deformGroup":"trglass_break"},
          ["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":2500,"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":5000,"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":4000,"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},
          ["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},
          {"beamPrecompression":1, "beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0},
          {"deformLimitExpansion":1.1},
    ],
    "triangles": [
            ["id1:","id2:","id3:"],
            //trunk
            {"groundModel":"metal"},
            {"group":"MG7KEN_trunk"},
            {"dragCoef":4},
            ["t3ll", "t3l", "t1l"],
            ["t3r", "t3rr", "t1r"],
            ["t1", "t3", "t3r"],
            ["t1", "t3l", "t3"],
            ["t1l", "t3l", "t1"],
            ["t1", "t3r", "t1r"],

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

    ],
},
}
