1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice
  3. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.36 Bug Reporting thread
    Solutions and more information may already be available.

jbeam, wait what? and how?

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by Gasoline_boy 2, Feb 3, 2018.

  1. Gasoline_boy 2

    Gasoline_boy 2
    Expand Collapse

    Joined:
    Apr 1, 2017
    Messages:
    132
    SO since my custom H-series isnt going to plan i need help with jbeam

    but please dont think im not putting all my effort into it

    I dont understand at all once so ever i import reference mesh from obj and i try adding nodes but where are they? are they ghost haunting me? how just please someone translate how i jbeam but in a IQ: -5

    im trying to release a super cool mod

    {totally trying to be family friendly since i just read this (excessive abusive language and similar behaviors is not nice and won't be tolerated.) so original lang isnt here}

    so please help me out im just trying to ge this mod done so i can work on game development :)
     
  2. atv_123

    atv_123
    Expand Collapse

    Joined:
    Aug 5, 2012
    Messages:
    1,711
    Well... I will give this a try... to understand "How" to JBeam, you must first understand "What" the JBeam is...

    Do you remember Magnetix? These things...


    That is basically what the JBeam physics structure is... accept all the colorful things in Beam are deformable springs. So it can squish.

    JBeam structures... like the Magnetix pictured above are made of two main components. The balls are the nodes. The beams... well... they are still beams.

    In BeamNG.Drive, the nodes are what interacts with the world. They have mass, and therefore, they have friction. They do not, however, have size. They are just points in space... put a bunch of nodes in a JBeam file and spawn it, all you basically end up with is sand... a bunch of little dots that fall to the ground and don't do much.

    Beams are what connect the nodes together and give everything made in BeamNG its shape. Beams also act like deformable springs. They can stretch, compress, deform, and eventually, break. Beams do not carry mass and do not interact with the world in any way other than the nodes that that particular beam is connected too.

    Naturally, with just a bunch of nodes and beams, the game would be rather ugly. To combat this, the crew behind BeamNG have come up with a clever solution of simply draping a pretty cloth over our ugly magnetix model. That is the mesh that you and I see on every vehicle every time you spawn into the game.

    To see this magic first hand, open the game. Once you hit the main menu, select options and then click user interface. Once there make sure that Enable Advanced Functions is checked. After you have done that, back out of the options menu and boot up a free roam world... doesn't matter which really, any will do. Once loaded and in game, press the Escape key. You should have a few more buttons there than you did previously and (most important) you should have a button that looks like a little betal. That is your debug option. Click that and then move down to Beam Visualization. Click the drop down list and select Simple. Then move down a bit further and you will see Node Visualization. Click the drop down list and select Simple again. You should now see BeamNG's secret sauce on your in game vehicle. The JBeam physics structure.

    1.png

    Honestly, it is beautiful in its simplicity while still being able to accurately simulate an entire vehicle physically correctly.

    Anyways... now that you know what it is, how do we make it? What defines the shape?

    Well, we are going to need a little bit of graphing paper... sort of...



    Here is a 2D Coordinate system. In this system you have 2 Dimensions (thus the D) or two directions in which you can travel. In math these dimensions are normally labeled X and Y. X in the case of this picture above would be the line traveling from Left to Right. Y, in turn, would then be line traveling from Bottom to Top. BeamNG is nothing more than a lot of math doing amazing things, so in the BeamNG world, they also call these X and Y. They also mean the exact same thing as I just described.

    To build a JBeam structure, you must define the positions of every Node in the system. That is done by using something called an Array. Essentially, it is a set of N numbers, that defines a position in N dimensional space. N purely meaning however many dimensions there are, we have a number to tell you where you are in that dimension... no more, no less.

    In our grid above, imagine that there is a point at X = 2 and Y = 4. That is a little lengthy to write out, so in math, we use an Array written as (2,4) to define the same thing. The first number of the Array is always X and the second is always Y... unless you are defining what they mean in some other way that I am not getting into here because that has nothing to do with Beam.

    Anyways, so if Beamng was a 2D system, we would define our node positions with 2D Arrays. Let's say we wanted to make a square in the grid system above. Our file would look similar to something like...

    nodes
    name, x, y
    n1,2,2
    n2,-2,2
    n3,-2,-2
    n4,2,-2

    Now, the n1, n2, n3, and n4 in this instance are just names I gave to the nodes to identify which ones they are. Besides... this becomes important in the next section.

    Next we have to have a Beams section otherwise we just have a bunch of random particles floating in space on our graphing paper. They have no connections to each other at this moment. So... let's give them some.

    Just as before in our 2D Arrays we defined a point 1 and a point 2 to give us a destination, now we are going to define which two points are connected. Basically... we are just connecting the dots at this point. To do this, we take the names we gave to each of the nodes and use them as the two coordinates in our array. Essentially, each node now becomes its own coordinate for which to define the beam.

    beams
    name1, name2
    n1, n2
    n2, n3
    n3, n4
    n4, n1

    We have defined the outer beams... essentially when we define beam n1, n2, we are just telling the game to draw a line between the two points. Pretty straight forward.

    "But wait!", I hear you ask, "Isn't BeamNG a 3D game?!" , and to that I say you are correct. Our graph above does not convey enough information. Instead we need something like this...



    Now instead of X and Y for Width and Length, we have X for Width, Y for Length, and Z for Height.

    The only thing that changes above is that for Nodes, we now use 3 numbers in our Array to define position instead of just 2 since we now have 3 dimensions. Luckily though, since Beams are defined as the path between 2 points, their creation stays exactly the same as the 2D example. So now, instead of a Square, let's define a Cube.

    nodes
    name, x, y, z
    n1, 2, 2, 2
    n2, -2, 2, 2
    n3, -2, -2, 2
    n4, 2, -2, 2
    n5, 2, 2, -2
    n6, -2, 2, -2
    n7, -2, -2, -2
    n8, 2, -2, -2

    beams
    n1, n2
    n2, n3
    n3, n4
    n4, n1
    n5, n6
    n6, n7
    n7, n8
    n8, n5
    n1, n5
    n2, n6
    n3, n7
    n4, n8

    So there you can see the most basic definition for defining a cube. Naturally I haven't written this in the exact format used in the file, but if you just have a glance through the Wiki, it will pop out off the page once you see it. Also I would go deeper in depth, but its 3:30AM and my head is about to hit my desk... if further explination is needed, I can provide that tomorow... right now I just want to get to bed before my head hits my desk... :p
     
  3. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,774
    You are using BNEditor, so first thing is to forget buttons, user interface and anything graphical, treat it just as a window that shows the situation.

    You write nodes under this node section heading:
    upload_2018-2-3_10-25-26.png

    So what I do is, select, copy and paste, like so:
    upload_2018-2-3_10-27-34.png

    Then edit it to represent name and coordinates of new node:
    ["exampleNumber1", 0.5, -1.8, 0.3], // Note that numbers don't have "" around them, if you have "" around numbers BNEditor might crash!

    After hitting that refresh button, I can see my node in 3d view:
    upload_2018-2-3_10-32-4.png

    After you have one there, just copy exampleNumber1 line and paste as new, then change numbers to match coordinates of your new node.

    Coordinates you can find from blender, select vertex that is at position of node that you want to add and look 'n' panel on right, there are your coordinates.

    You might of course already have some jbeam file that you are basing your work on, it is much easier to edit some nodes and beams that are somewhat near to your object than to make on from scratch. Like for example H-series jbeam.

    Update: I thought I would be ninja'd, but I guess our posts just compliment each other, now all this should then be in a Wiki, once again.
     
  4. Gasoline_boy 2

    Gasoline_boy 2
    Expand Collapse

    Joined:
    Apr 1, 2017
    Messages:
    132
    so make a box the represents my vehicles body? with nodes and beams?
     
  5. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,774
    Yes, that of course depends what you are making for H-series, do you need new frame too? If yes, then you need to do the frame first, then body, if you can use H-series frame, then just the body.

    You can open H-series files in NBEditor and look how it is made to get better idea.
     
  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