Step by step truck construction
From Rigs Of Rods
Okay, we will build a truck step by step
Contents |
Step 1: the big picture
First, draw the big architectural lines of you truck.
How many wheels, which kind of geometry (cubic or prismatic) how many truss group, etc. Often you build a strong chassis base, that supports a lighly build cab structure, to lower the center of gravity and to have a more realistic deformation in case of crash. The most practical chassis structure is a cubic structure with three cell groups. The cubic is heavier than the prismatic but is easyer 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.
Good chassis architecture are:
- strong
- light (as few nodes as possible=more frame per second)
- provide well placed nodes to attach other parts of the truck (cab, suspensions, loads...)
As we do a very simple truck, we are going for a minimalistic design: a single-cell cubic structure, with three segments.
Yes, we are going to do this sorry piece of soapbox... ;-)
Step 2: the blueprint
Now that we know the big picture, we do a scaled plan of the truck. I use a drawing paper and a pen, it saves a lot of time, and this plan is very important for the next steps, because we will be looking for nodes numbers all the time, and having this sheet of paper under the keyboard helps a lot! This is also the time to find the dimensions (metric mode please) of the truck. FYI, most truck are 2.50 meter large.
So we draw the left side view (up) and top view (down), we position the nodes and we number them. Generally, nodes overlap each over so I 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.
Notice the reference vectors :
- X front to back
- Y bottom to top
- Z right to left
Now we are ready to begin the truck file
Step 3: starting the .truck file
Create a text file in the data/trucks directory of Rigs of Rods. Let's call it "tutorial.truck". We begin with the truck name, that must absolutely be the first line of the file:
Tutorial truck
Then the globals, containing the dry mass (10 tons), the load mass (zero, we don't use loaded nodes) and any pre-existing material name (we don't care yet).
globals 10000.0, 0.0, tracks/semi
Then we add the nodes, with their coordinates that we get from the plan, and the beams. For the beams I add the "structural" beams that follow the cubic structure, and the "reinforcements" beams that triangulates and rigidify the structure. The separation helps to debug in case of errors. Before we end, we must 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 the end at the end. We get this 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
And as we can see, the chassis looks good:
Step 4: adding the wheels
In order to be able to add the wheels, we need to define the axles. To do this we 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. We 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, 1.0,-0.5, 3.0 21, 1.0,-0.5, 2.5 22, 1.0,-0.5,-0.5 23, 1.0,-0.5,-1.0
Then we add to the beams section the axle beams.
16,17 17,18 18,19 20,21 21,22 22,23
Then we must take care of the suspensions. For the sake of simplicity, we will begin with simple arm suspensions, and ignore the direction. 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
We need to add shocks. We do this by adding 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