Migrating Content

Migrating Content

From BeamNG
Language: [[::Migrating Content|English]]  • [[::Migrating Content/ru|русский]]

Migrating Content

This page is a tutorial on how to migrate content from Rigs of Rods into BeamNG (.truck to .jbeam)




Basic Node/Beam Structures

First off, lets start off with a blank JBeam file shall we?

{
"vehiclename": {
    "information":{
        "authors":"yourname",
        "name":"vehiclename",
    }
    "nodes" :[
["id", "posX", "posY", "posZ"],
],
"beams": [
["id1:", "id2:"],
],
}
}

Looks pretty simple right? Now let's migrate a few nodes from a truck file !

Here are the nodes as they appear in the truck file:

0, -0.88, 0.20, -0.82, l 4.0
1, -1.06, 0.20, -0.42, l 10.9
2, -1.11, 0.20, 0, l 10.9
3, -1.06, 0.20, 0.42, l 10.9
4, -0.88, 0.20, 0.82, l 4.0
5, -0.27, 0.20, -0.82, l 4.0
6, -0.27, 0.20, -0.41, l 7.2
7, -0.27, 0.20, 0.41, l 7.2
8, -0.27, 0.20, 0.82, l 4.0
9, 0.27, 0.20, -0.82, l 4.0
10, 0.27, 0.20, -0.41, l 7.2

So we have 10 nodes here, now the basic node structure for JBeam as stated above is "["id", "posX", "posY", "posZ"]". Soo, let's migrate these 10 nodes into the JBeam file!

{

"vehiclename": {
    "information":{
        "authors":"yourname",
        "name":"vehiclename",
    }
    "nodes" :[
["id", "posX", "posY", "posZ"],
["n0",  0.079184,  0.32,  -0.83752 ],
["n1",  0.05096,  -0.5888,  -0.9082 ],
["n2",  -1.045072,  -0.5888,  -0.9082 ],
["n3",  -0.978432,  0.2488,  -0.83752 ],
["n4",  -0.522144,  0.672,  0 ],
["n5",  0.12936,  0.7832,  0 ],
["n6",  0.12936,  0.7192,  -0.61332 ],
["n7",  -0.464128,  0.6184,  -0.61332 ],
["n8",  0.69776,  0.7696,  0 ],
["n9",  0.70168,  0.7232,  -0.61332 ],
["n10",  1.201872,  0.6824,  0 ],
],
"beams": [
["id1:", "id2:"],
],
}
}

Seems pretty simple right, just add a 'n' before the node number and then the node number for the ID (n[nodenumber]), then just put in our coordinates and bam! Nodes in JBeam format.


Next, we will be doing beams, here are my first 10 beams I will be putting into the JBeam file:

1, 2, i
0, 2, i
3, 2, i
4, 5, i
6, 4, i
6, 5, i
8, 5, i
9, 6, i
6, 8, i
9, 8, i


As you can see it is id1 and id2, same as RoR just JBeam style, here I will not copy the whole JBeam file but rather just the beams section, filled with our first 10 beams

"beams": [
["id1:", "id2:"],
["n1", "n2"],
["n0", "n2"],
["n3", "n2"],
["n4", "n5"],
["n6", "n4"],
["n6", "n5"],
["n8", "n5"],
["n9", "n6"],
["n6", "n8"],
["n9", "n8"],
],

Now, you may ask "what about set beam defaults?", Well here is the basic code for setting beam settings in JBeam

 {"beamSpring":1251000,"beamDamp":250},      {"beamDeform":16000,"beamStrength":24000},

Now set_beam_defaults has these 4 parameters: spring damp deform break So lets translate the following line to a JBeam beam settings code:

set_beam_defaults 3000000,   10000, 100000, 250000

So we have the beamSpring at 3000000, the beamDamp at 10000, the beamDeform at 100000 and the beamBreak at 250000


So now in JBeam, we have

 {"beamSpring":3000000,"beamDamp":10000},      {"beamDeform":100000,"beamStrength":250000},

Now you may be asking, where do you put this code!?!?!?!?. Well, you just put it in your beams section just as in RoR, like so:

"beams": [
["id1:", "id2:"],
["n1", "n2"],
{"beamSpring":3000000,"beamDamp":10000},      {"beamDeform":100000,"beamStrength":250000},
["n0", "n2"],
],


The completed JBeam Test File

{
 
"vehiclename": {
    "information":{
        "authors":"yourname",
        "name":"vehiclename",
    }
    "nodes" :[
["id", "posX", "posY", "posZ"],
["n0",  0.079184,  0.32,  -0.83752 ],
["n1",  0.05096,  -0.5888,  -0.9082 ],
["n2",  -1.045072,  -0.5888,  -0.9082 ],
["n3",  -0.978432,  0.2488,  -0.83752 ],
["n4",  -0.522144,  0.672,  0 ],
["n5",  0.12936,  0.7832,  0 ],
["n6",  0.12936,  0.7192,  -0.61332 ],
["n7",  -0.464128,  0.6184,  -0.61332 ],
["n8",  0.69776,  0.7696,  0 ],
["n9",  0.70168,  0.7232,  -0.61332 ],
["n10",  1.201872,  0.6824,  0 ],
],
"beams": [
["id1:", "id2:"],
["n1", "n2"],
{"beamSpring":3000000,"beamDamp":10000},      {"beamDeform":100000,"beamStrength":250000},
["n0", "n2"],
["n3", "n2"],
["n4", "n5"],
["n6", "n4"],
["n6", "n5"],
["n8", "n5"],
["n9", "n6"],
["n6", "n8"],
["n9", "n8"],
],
}
}