Disconnecting Sway Bar Links

Discussion in 'Ideas and Suggestions' started by Tomcat9700 2, Dec 28, 2021.

  1. Tomcat9700 2

    Tomcat9700 2
    Expand Collapse

    Joined:
    Mar 27, 2017
    Messages:
    27
    I think that an on the fly disconnecting sway bar is the next step in the off-road aspect. I love wheeling on the trails without a sway bar for obvious reasons. However once you pickup speed or you travel on the road, not having those sway bars can be scary. I've attempted this myself with no progress. Has this been done or anyone tried? I've only found one other thread from 2017 that didn't go anywhere.


    CH4X4-TOY-SWBARD.jpg
     
    • Agree Agree x 2
  2. SKB

    SKB
    Expand Collapse

    Joined:
    Apr 22, 2017
    Messages:
    1,964
    Hmm, disconnectable sway bars would be cool, just wondering how it would work in game,
    I know you can lock/unlock diffs, but sway bars let your wheels have more travel, and I'm guessing it would also need to be a visual animation or something for it disconnecting...
    Can be done (probably)
     
    • Agree Agree x 1
  3. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,056
    Can be done definitely. There is a LUA controller for adaptive torsion bars that lets you modify spring and damp coef on the fly. It is unused but should work like the Vivace adaptive dampers. So changes behavior based on selected drivemode (comfort/offroad - soft, sport/off - hard). You can set the spring and damp coef to 0 for soft mode and this should disable the torsionbars. Then add the adaptive torsionbars controller with your sway bar names as torsionbars, and add 2 drive modes to the vehicle: sport and off-road, with references to the controller. This is theoretically how you should do it, not tested but should work:
    Code:
    "carname_DSE": {
            "information":{
                "authors":"Diamondback",
                "name":"Driving & Safety Electronics",
                "value":250,
            },
            "slotType" : "carname_DSE",
            "slots":[
                ["type", "default", "description"],
    ["carname_DSE_drivemodes","carname_DSE_drivemodes_ICE", "Drive Modes"],
            ]
            "controller": [
                ["fileName"],
                ["drivingDynamics/CMU", {"name":"CMU", "debugSettings": {"enableDebugMode": false, "peerIP": "127.0.0.1"}}]
                ["drivingDynamics/sensors/sensorHub" ]
                ["drivingDynamics/sensors/virtualSensors" {"name":"sensors"}]
                ["drivingDynamics/sensors/vehicleData" {"name":"vehicleData"}]
                ["drivingDynamics/supervisors/components/motorTorqueControl" {"name":"motorTorqueControl"}]
                ["drivingDynamics/supervisors/components/brakeControl" {"name":"brakeControl"}]
            ],
        },
    Code:
    "carname_DSE_drivemodes_ICE": {
            "information":{
                "authors":"Diamondback",
                "name":"Drive Modes (ICE)",
                "value":250,
            },
            "slotType" : "carname_DSE_drivemodes",
            "controller": [
                ["fileName"],
                ["driveModes"]
            ],
            "driveModes": {
                "enabledModes":[ "sport", "offroad"]
                "defaultMode": "sport"
                "defaultSettings": [
                    ["type"]            
    ["controller", {"controllerName":"adaptiveSwaybarF", "TorsionBarMode":"hard"}]
    ["controller", {"controllerName":"adaptiveSwaybarR", "TorsionBarMode":"hard"}]
    "modes": {
                    "sport": {
                        "name": "Sport",
                        "order": 10,
                        "settings": [
                            ["type"]                        
    ["controller", {"controllerName":"adaptiveSwaybarF", "TorsionBarMode":"hard"}]
    ["controller", {"controllerName":"adaptiveSwaybarR", "TorsionBarMode":"hard"}]
                        ],
                    },
    "offroad": {
                        "name": "Offroad",
                        "order": 20,
                        "settings": [
                            ["type"]
                          ["controller", {"controllerName":"adaptiveSwaybarF", "TorsionBarMode":"soft"}]
    ["controller", {"controllerName":"adaptiveSwaybarR", "TorsionBarMode":"soft"}]
                        ],
                    },
    },
        },
    
    Code:
    "carname_swaybar_F_disconnectable": {
        "information":{
            "authors":"BeamNG",
            "name":"Disconnectable Front Sway Bar",
            "value":140,
        },
        "slotType" : "carname_swaybar_F",
    
        "flexbodies": [
            ["mesh", "[group]:", "nonFlexMaterials"],
            ["carname_swaybar_F", ["carname_swaybar_F"]],
        ],
       "controller": [
            ["fileName"],
            ["drivingDynamics/actuators/adaptiveTorsionBars" {"name":"adaptiveSwaybarF", "torsionBarNames":["swaybar_F"]}]
        ],
        "adaptiveSwaybarF": {
            "modes": [
                ["name",    "springCoef", "dampCoef"]
                ["soft",    0.0,            0.0,                 ]
                ["hard",    1.0,            1.0,                  ]
            ]
        }
        "nodes": [
             ["id", "posX", "posY", "posZ"],
             //anti-roll
             {"nodeMaterial":"|NM_METAL"},
             {"frictionCoef":0.5},
             {"group":""},
             {"selfCollision":false},
             {"collision":true},
             {"nodeWeight":1.4},
             //front anti-roll
             {"group":"carname_swaybar_F"},
             ["arbfr", -0.53, -1.44, 0.25],
             ["arbfl", 0.53, -1.44, 0.25],
             {"group":""},
        ],
        "torsionbars": [
            ["id1:", "id2:", "id3:", "id4:"],
            //18mm 2482
            //19mm 3081
            //20mm 3782
            //21mm 4598
            //22mm 5538
            //24mm 7843
            {"spring":3782, "damp":10, "deform":10000, "strength":9999999},
            ["arbfr", "fx2r", "fx2l", "arbfl" , {"name":"swaybar_F"}],
        ],
        "beams": [
              ["id1:", "id2:"],
              //--ANTI-ROLL--
              {"beamPrecompression":1, "beamType":"|NORMAL", "beamLongBound":1, "beamShortBound":1},
              {"beamSpring":2501000,"beamDamp":100},
              {"beamDeform":15000,"beamStrength":312000},
              //end links
              ["arbfr","fh4r"],
              ["arbfl","fh4l"],
              //rigids
              ["arbfr","fx2r"],
              ["arbfl","fx2l"],
              ["arbfr","fx2l"],
              ["arbfl","fx2r"],
    
              //mesh breakers
              {"beamPrecompression":1., "beamType":"|SUPPORT", "beamLongBound":2},
              {"beamSpring":0,"beamDamp":0},
              {"beamDeform":15000,"beamStrength":80000},
              {"deformLimitExpansion":""},
              ["arbfr","fs2r"],
              ["arbfl","fs2l"],
              {"beamPrecompression":1, "beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0},
        ],
    },
    Code:
    "carname_swaybar_R_disconnectable": {
        "information":{
            "authors":"BeamNG",
            "name":"Disconnectable Rear Sway Bar",
            "value":140,
        },
        "slotType" : "carname_swaybar_R",
    
        "flexbodies": [
            ["mesh", "[group]:", "nonFlexMaterials"],
            ["carname_swaybar_R", ["carname_swaybar_R"]],
        ],
       "controller": [
            ["fileName"],
            ["drivingDynamics/actuators/adaptiveTorsionBars" {"name":"adaptiveSwaybarR", "torsionBarNames":["swaybar_R"]}]
        ],
        "adaptiveSwaybarR": {
            "modes": [
                ["name",    "springCoef", "dampCoef"]
                ["soft",    0.0,            0.0,                 ]
                ["hard",    1.0,            1.0,                  ]
            ]
        }
        "nodes": [
             ["id", "posX", "posY", "posZ"],
             //anti-roll
             {"nodeMaterial":"|NM_METAL"},
             {"frictionCoef":0.5},
             {"group":""},
             {"selfCollision":false},
             {"collision":true},
             {"nodeWeight":1.4},
             //rear anti-roll
             {"group":"carname_swaybar_R"},
             ["arbrr", -0.53,  1.44, 0.25],
             ["arbrl", 0.53,  1.44, 0.25],
             {"group":""},
        ],
        "torsionbars": [
            ["id1:", "id2:", "id3:", "id4:"],
            //18mm 2482
            //19mm 3081
            //20mm 3782
            //21mm 4598
            //22mm 5538
            //24mm 7843
            {"spring":3782, "damp":10, "deform":10000, "strength":9999999},
            ["arbrr", "rx2r", "rx2l", "arbrl" , {"name":"swaybar_R"}],
        ],
        "beams": [
              ["id1:", "id2:"],
              //--ANTI-ROLL--
              {"beamPrecompression":1, "beamType":"|NORMAL", "beamLongBound":1, "beamShortBound":1},
              {"beamSpring":2501000,"beamDamp":100},
              {"beamDeform":15000,"beamStrength":312000},
              //end links
              ["arbrr","rh4r"],
              ["arbrl","rh4l"],
              //rigids
              ["arbrr","rx2r"],
              ["arbrl","rx2l"],
              ["arbrr","rx2l"],
              ["arbrl","rx2r"],
    
              //mesh breakers
              {"beamPrecompression":1., "beamType":"|SUPPORT", "beamLongBound":2},
              {"beamSpring":0,"beamDamp":0},
              {"beamDeform":15000,"beamStrength":80000},
              {"deformLimitExpansion":""},
              ["arbrr","rs2r"],
              ["arbrl","rs2l"],
              {"beamPrecompression":1, "beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0},
        ],
    },
    --- Post updated ---
    So I made a mod that adds this to the Hopper. But it overall works kinda weird and once you disconnect the sway bars they don't reconnect until you reset the car. You need to put sway bar controller in Additional Modification and disconnectable sway bars in sway bar slots.
     

    Attached Files:

    • Like Like x 4
  4. Tomcat9700 2

    Tomcat9700 2
    Expand Collapse

    Joined:
    Mar 27, 2017
    Messages:
    27
    Very interesting. I am going to tinker with this. Thank you!
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice