Help with jbeam

Discussion in 'Mod Support' started by bastion.exe, Jan 15, 2022.

  1. bastion.exe

    bastion.exe
    Expand Collapse

    Joined:
    Jan 13, 2022
    Messages:
    241
    Please, if you understand JBeam and you have time, teach me the basic skills
     
  2. TC203

    TC203
    Expand Collapse

    Joined:
    Sep 9, 2020
    Messages:
    133
    Code:
    {
    "name_of_thing": {
        "information":{
            "authors":"your_name",
            "name":"Name of thing in ui",
        },
        "slotType" : "name_of_slot",
        "slots": [
            ["type", "default", "description"],
            //bodywork
            ["other_slot","other_slot", "Other Slot"],
        ],
    },
    }
    Starting your jbeam
    You always have to start with a { at the top. On the second line (always is in speech marks) is the name of your thing in the code. For example, "citybus_engine". Next is always the information. I don't think I need to explain what the "authors" sections means ;). The "name" part is what your thing will be called in the parts selector.
    "SlotType" is quite obvious and is the name of the slot your thing goes into. For example, "pigeon_engine_600" could go in the slot "pigeon_engine" meaning you would put "pigeon_engine" as the slotType. "slots" is where you list slots where you can put other things. For example, semi_engine could have a slot for semi_turbo.The "type" part is the name of your slot, the "default" part is the name of the default thing that goes in that slot and the "description" part is a very brief description of what it is that goes in the slot (this will appear next to the slot in the parts selector). The "slots" section is optional if the part doesn't have any slots. The ending of you section (in this case the section is "slots") is determined by whether it was a [ or a { at the start. In this case, it is "slots": [ which means it would end in ],. If it started with a { it would end in },.

    Nodes
    Code:
        "nodes" :[
             ["id", "posX", "posY", "posZ"],
             {"group":"thing"},
             {"selfCollision":false}
             {"collision" :true}
             {"nodeMaterial":"|NM_METAL"},
             {"frictionCoef":0.7},
             {"nodeWeight":3},
             ["node1", 0, -2.17, -0.66],
             {"group":""}, 
        ],
    Nodes are like little dots/vertices that determine the weight and positioning of things. This a simple nodes section. To start things off, I'm going to talk about the axis. The X axis is left and right (you add to go left), the Y axis is forwards and backwards (add to go backwards) and the Z axis is up and down (add to go up). The "group" part is the name of your group of nodes where a flexbody can be put (I don't know whether you need flexbodies or not). I'm not entirely sure what SelfCollision and Collision are for but I'm guessing they do wat they say on the tin. "nodeMaterial" is what material your nodes are made from. There are many materials to chose from including wood and plastic. "frictionCoef" is (I'm pretty sure) how much friction it makes when it touches the ground. "nodeWeight" is how much the node weighs in kg. Onto making the actual nodes now. the first part is the "id" section which is the name of your node. Second, third and fourth are the position of the node on the X, Y and Z axis. the {"group":""}, part at the bottom is tell beamng that the group we mentioned before as ended. If the nodes section has more than one group, you don't need to end the first group with {"group":""}, and then start the next one just start the next one like this:
    Code:
             {"group":"thing"},
             {"selfCollision":false}
             {"collision" :true}
             {"nodeMaterial":"|NM_METAL"},
             {"frictionCoef":0.7},
             {"nodeWeight":3},
             ["node1", 0, -2.17, -0.66],
             {"group":"thing2"},
             ["node2" 0, -2.76, -0.36],
             {"group":""},
    Beams
    Code:
              "beams": [
              ["id1:", "id2:"],
              {"beamPrecompression":1, "beamType":"|NORMAL", "beamLongBound":1.0, "beamShortBound":1.0},
              {"beamSpring":130100,"beamDamp":50},
              {"beamDeform":448000,"beamStrength":779879"},
              {"deformLimitExpansion":1.1},
              ["thing", "thing2"],
        ],
    Beams are things that connect nodes together and make the structure and strenth of your object. "beamPrecompression" is the length of you beam. If it is set to 1 it will be at its default length, if it's set to 2 it will be double its original length. You can check the wiki for more info on the "beamType", "BeamLongBound" and "BeamShortBound" sections. "BeamSpring" is how stiff/ springy the beam is. "BeamDamp" is how much energy is disipated when under stress. "BeamDeform" is how much pressure it takes to deform the beam. The higher the value, the more stress it can withstand before it deforms. "BeamStrenth" is how much pressure it takes to break the beam. The higher the value, the more pressure it takes to break it. "DeformLimitExpansion" (I think) is how far the beam can deform. When making beams the "id1" is the first node in the beam and "id2" is the second node. In this example, the first node is thing which connects to thing2.

    Stuff I Forgot to Mention
    If you want to put in text without it being read by beamng you can simply put a // next to it, this means that beamng will skip that section. I ofte use this to make notes as to what things are (like in the first code example where I had //bodywork.

    Ending your jbeam
    When ending your jbeam, you have to first end your segment with either ], or }, then put a
    },
    }
    Make sure your }, } is against the edge of the page like in the first code example.

    If you need any other things explaining like triangles, flexbodies etc. Please tell me and I can. Sorry if I made some typos, I do that a lot. :D
     
    • Like Like x 4
    • Staff Pick Staff Pick x 1
  3. bastion.exe

    bastion.exe
    Expand Collapse

    Joined:
    Jan 13, 2022
    Messages:
    241
    Thanks a lot! But today i cant find time to read this
     
  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