Step by step truck construction
From Rigs Of Rods
(→Step 5: adding the wheels) |
|||
Line 216: | Line 216: | ||
We declare the radius and the 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 rigidification 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. Then you define if it is breaked and propulsed (0 for no, 1 for yes). The reference node is where the wheel couple is applied. You should choose the attachement point of the suspension arm. Then comes the mass of the wheel, the spring/damp factor of the wheel, and the names of the materials to texture the wheels (these are defauls values). Ouch! | We declare the radius and the 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 rigidification 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. Then you define if it is breaked and propulsed (0 for no, 1 for yes). The reference node is where the wheel couple is applied. You should choose the attachement point of the suspension arm. Then comes the mass of the wheel, the spring/damp factor of the wheel, and the names of the materials to texture the wheels (these are defauls values). Ouch! | ||
<pre> | <pre> | ||
- | |||
- | |||
wheels | wheels | ||
;rad,width,numrays,node1,node2,rigid,braked,propulsed,ref,mass ,spring ,damp,texface,texband | ;rad,width,numrays,node1,node2,rigid,braked,propulsed,ref,mass ,spring ,damp,texface,texband |
Revision as of 12:52, 14 February 2006
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 suspensions
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, 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 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
So far so good...
Step 5: adding the wheels
Now we are ready to declare the 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. We declare the radius and the 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 rigidification 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. Then you define if it is breaked and propulsed (0 for no, 1 for yes). The reference node is where the wheel couple is applied. You should choose the attachement point of the suspension arm. Then comes the mass of the wheel, the spring/damp factor of the wheel, and the names of the materials to texture the wheels (these are defauls values). Ouch!
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...
Step 6: adding an engine
Adding an engine is easy. Just add this section:
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 is the torque: this defines the power of your engine.