Step by Step Truck Construction (old)

From Rigs of Rods Wiki

Jump to:navigation, search

Contents

Introduction

To make trucks in Rigs of Rods, you need to understand how the game functions. Rigs of Rods simulates vehicles by connecting nodes via beams. Nodes are simply points in space. Beams are what connect nodes together. The vehicle in this example can be done entirely in Notepad, Wordpad, or a basic text editor of your choice. If you have questions regarding syntax, please refer to the Truck Description File page which is the full documentation of syntax. Be prepared to devote a chunk of time to learning the syntax and testing your vehicle!

Planning

It is wise to plan your truck before you begin your work in RoR. Things to keep in mind:

  • How many wheels will you have?
  • Which kind of geometry (cubic or prismatic) ?
  • How many truss group?

Often you build a strong chassis base that supports a cab structure, lowers the center of gravity, and deforms realistically in impact. The most practical chassis structure is a cubic structure with three cell groups. The cubic is heavier than the prismatic, but is easier to integrate (for a cubic example see the TurboTwin truck, and for the prismatic see the Wrecker truck). Other arrangements are possible, you can try whatever you want.

A good chassis is strong, light (less nodes, more frames per second) and is modular so that other parts of the vehicle can be attached (cab, suspensions, loads, and etc.).

This example will walk through a minimalistic design: a single-cell cubic structure, with three segments. It is a good idea to start out simple, as a complex design can lead to frustration.

Tt-step1.jpg

Yes, we are going to do this sorry piece of soapbox... ;-)

The Blueprint

Now that we know the big picture, we do a scaled plan of the truck. Using drawing paper and a pen saves a lot of time, and is very important for the next steps, because the drawing will serve as a reference for nodes, and having this sheet of paper under the keyboard helps a lot! This is also the time to find the dimensions (1.00 unit in RoR = 1 meter) of the truck.

Draw the left side view (up) and top view (down), position the nodes, and number them. Generally, nodes overlap each over so number the overlapped nodes by separating them with a horizontal bar. We will do the chassis first, so I numbered only the chassis nodes for the moment.

Tt-step2.jpg

Notice the reference vectors:

  • X is front to back
  • Y id bottom to top
  • Z right to left

The Truck File

Create a text file in the data/trucks directory of Rigs of Rods. Call it tutorial.truck The first line MUST begin with the truck name:

Tutorial Truck

Then the globals section, containing the dry mass (in this case, 10 metric tons), the load mass (zero, no loaded nodes) and any pre-existing material name (don't need this yet).

globals
10000.0, 0.0, tracks/semi

Then add the nodes, with the coordinates from the drawn plan, and the beams. The beams section has "structural" beams that follow the cubic structure, and the "reinforcement" beams that triangulates and strengthens the structure. This separation helps to debug in case of errors.

After adding the nodes, define some points of reference on the chassis with the cameras and cinecam sections. The first takes a reference node (any node will do), a node straight behind and a node straight left. The second takes the coordinates of the internal camera, and 8 attach nodes. This gives:

cameras
2,6,0
 
cinecam
;x,y,z,bindings
0.5, 0.5, 1.0, 0,1,2,3,4,5,6,7

Finally, never forget to end your truck file! Here is the resulting file:

Tutorial truck
 
globals
10000.0, 0.0, tracks/semi
 
nodes
;id,x,   y,   z
 0, 0.0, 1.0, 2.0
 1, 0.0, 0.0, 2.0
 2, 0.0, 1.0, 0.0
 3, 0.0, 0.0, 0.0
 4, 1.0, 1.0, 2.0
 5, 1.0, 0.0, 2.0
 6, 1.0, 1.0, 0.0
 7, 1.0, 0.0, 0.0
 8, 3.0, 1.0, 2.0
 9, 3.0, 0.0, 2.0
10, 3.0, 1.0, 0.0
11, 3.0, 0.0, 0.0
12, 4.0, 1.0, 2.0
13, 4.0, 0.0, 2.0
14, 4.0, 1.0, 0.0
15, 4.0, 0.0, 0.0
 
beams
;main chassis
;structural
0,1
2,3
4,5
6,7
8,9
10,11
12,13
14,15
 
0,4
1,5
2,6
3,7
4,8
5,9
6,10
7,11
8,12
9,13
10,14
11,15
 
0,2
1,3
4,6
5,7
8,10
9,11
12,14
13,15
 
;reinforcements
0,6
1,7
2,4
3,5
4,10
5,11
6,8
7,9
8,14
9,15
10,12
11,13
 
0,5
1,4
2,7
3,6
4,9
5,8
6,11
7,10
8,13
9,12
10,15
11,14
 
0,3
1,2
4,7
5,6
8,11
9,10
12,15
13,14
 
cameras
2,6,0
 
cinecam
;x,y,z,bindings
0.5, 0.5, 1.0, 0,1,2,3,4,5,6,7
 
end

Here is the chassis rendered in RoR:

Tt-step3.jpg

Adding Suspension

Axles are required in order to add wheels. To do this, define additional nodes: two for each wheel, placed at the intersections of the wheel and the axle. These nodes will have numbers 16 to 23. Add to the node section:

16, 1.0,-0.5, 3.0
17, 1.0,-0.5, 2.5
18, 1.0,-0.5,-0.5
19, 1.0,-0.5,-1.0
20, 4.0,-0.5, 3.0
21, 4.0,-0.5, 2.5
22, 4.0,-0.5,-0.5
23, 4.0,-0.5,-1.0

Then add the axle beams to the beams section:

16,17
17,18
18,19
 
20,21
21,22
22,23

Now take care of the suspension. For the sake of simplicity, begin with simple arm suspensions, and ignore steering. Doing the arms of the suspension is simple, just add the following beams:

1,17
3,18
1,18
3,17
 
9,21
11,22
9,22
11,21

To add shocks, add a shocks section. It is like a normal beam, but with adjustable spring and damp ratio.

shocks
;critical damp=2*sqrt(mass*spring)
;id1, id2, spring, damp, shortbound, longbound, precomp
17,4, 300000,35000, 0.3, 0.3, 1.0
18,6, 300000,35000, 0.3, 0.3, 1.0
21,8, 300000,35000, 0.3, 0.3, 1.0
22,14, 300000,35000, 0.3, 0.3, 1.0

Here is the chassis with suspension and axles in RoR:

Tt-step4.jpg

Adding Wheels

Wheels are made of beams, like the chassis, but it would be a pain to input wheels this way. The wheel section simplifies this, allowing to declare a complete textured wheel in a single line.

Wheels are defined by:

  • The radius and width (which must be the same as the distance between the two attaching nodes)
  • The number of rays (12 is a good number)
  • The attaching nodes (always in increasing Z order)
    • The rigid node is used to make the axle rigid across the three segments.
    • You must choose the opposite node of the same axle, with a "-" in front if its Z is lower then the attaching nodes.
  • If it is braked and propulsed (0 for no, 1 for yes)
  • The reference node (where the wheel couple is applied)
    • You should choose the attachment point of the suspension arm
  • The mass of the wheel
  • The spring/damp factor of the wheel
  • The names of the materials to texture the wheels (these are default values)
wheels
;rad,width,numrays,node1,node2,rigid,braked,propulsed,ref,mass ,spring  ,damp,texface,texband
0.75, 0.50, 12, 19, 18, 17, 1, 1, 3, 175.0,400000.0,3000.0,tracks/wheelface tracks/wheelband1
0.75, 0.50, 12, 17, 16, -18, 1, 1, 1, 175.0,400000.0,3000.0,tracks/wheelface tracks/wheelband1
0.75, 0.50, 12, 23, 22, 21, 1, 1, 11, 175.0,400000.0,3000.0,tracks/wheelface tracks/wheelband1
0.75, 0.50, 12, 21, 20, -22, 1, 1, 9, 175.0,400000.0,3000.0,tracks/wheelface tracks/wheelband1

Now this is getting ridiculous...

Tt-step5.jpg

Adding an Engine

Adding an engine is easy. For now, simply add this section and read the Truck Description File for more information.

engine
;min rpm, max rpm, torque, differential ratio, rear gear, first, second, third, fourth, fifth, sixth
1000.0, 1500.0, 6000.0, 2.00, 10.85,  13.86, 9.52, 6.56, 5.48, 4.58, 3.83, 3.02, 2.53, 2.08, 1.74, 1.43, 1.20, 1.00, -1.0

The only really important value here, for now, is the torque: this defines the power of your engine.

Adding Steering

The simplest steering setup involves 6 nodes. Four nodes form a diamond, the fifth is in the center of this diamond and the sixth is outboard of this diamond. The sixth node is then braced to all four nodes of the diamond, with the two forward and backward made hydros. This is the simplest steering system for now. Each diamond is called a Knuckle. This includes the 6th node that defines the axle the wheel rotates on.

Some key terms:

  • Knuckle - Each "diamond" you make, including the sixth node that defines the wheel's axle.
  • Hydro - Beams that allow you to have steering. These are controlled by the arrow keys, or whatever axis you have set to steer. They return to center when no input is given. Engine can be off and they will still work.
  • Command - A hydro controlled by F1-F12. They stay wherever they stop at when you release the button. Engine must be started for them to work.
  • Node - A point in space, this is what the beams connect to.
  • Beam - These make the shape visible! Always triangulate your shapes, or they will fold.

For example, there are 6 nodes: 1, 2, 3, 4, 5, and 6.

  • Node 1 will be the hub.
  • Node 2 is placed above node (higher Y value).
  • Node 3 is placed in front of node 1 (lower X value).
  • Node 4 is behind node 1 (higher X value).
  • Node 5 is below node 1 (lower Y value).
  • Node 6 is outboard of node one (different Z value) depending on side of truck.

Here is a drawing of this example. Nodes that line up on the same axis are omitted for clarity. 6 new nodes, 7 8 9 10 11 12, have been added to add a second side. Beams are denoted (#, #), where the # is the node number:

View looking down the axle, both sides. R = Right knuckle, L = Left knuckle:

 
        Right            Left
 
          2               7
 
      4   1   3      12   10  11  
 
          5               8

View looking at the axle from the front:

     Right             Left
 
      2                  7
 
 6    1                  10    9
 
      5                  8


Beams (2, 6), (5, 6), (7, 9) and (8, 9) are normal beams. If you want to change the camber, you can make (2, 6), (5, 6), (7, 9) and (8, 9) commands. Beams (4, 6), (3, 6), (12, 9) and (11, 9) are where you mount your steering hydros.

Some systems have beams (4,6), (3, 6), (12, 9) and (11, 9) solid, and beams (3, 12), and (11, 4) hydros, as well as (3, 11) and (4, 12). This is equally easy to build and usually used on large trucks. Flip the 6x6 DAF over and you'll see what I mean. If you use the first system I described, just connect all the corners of the diamond with rigid beams, then run beams to the chassis as you see fit to attach the axle. If you use the other system, the remaining beams in there remain solid except the ones that connect to nodes 3, 12, 11, 4. They are your steering hydros.

Tips to set a hydro:

In the truck file, a hydro resides under the hydro section, and looks like this:

hydros
4, 6, 0.33
3, 6, -0.33
12, 9, -0.33
11, 9, 0.33

To change the direction the hydro moves, if the steering is backwards(You input left, wheels both turn right), you would change it to:

hydros
4, 6, -0.33
3, 6, 0.33
12, 9, 0.33
11, 9, -0.33

Notice how the negatives moved? That negative makes the hydro shorten, without it makes the hydro lengthen.

If you input left or right and the wheels just point in to each other, or away from each other, you change the negatives to this:

hydros
4, 6, -0.33
3, 6, 0.33
12, 9, -0.33
11, 9, 0.33

See how one negative has moved? That reverses the hydros on one corner. What if it's backwards? Do this:

hydros
4, 6, 0.33
3, 6, -0.33
12, 9, 0.33
11, 9, -0.33

Now, all the hydros have been reversed. It should work now.

Conclusion

This tutorial is intended to get you familiar with the syntax and process of creating vehicles for Rigs of Rods. More advanced topics can be found in the Truck Description File.



About Rigs of Rods

    Rigs of Rods is a unique soft body physics simulator.


Some Tools


Partners

SourceForge.net

Follow us

Twitter youtube Facebook RSS Feed


impressum