RoRBook/Basic Truck Requirements
From Rigs of Rods Wiki
Basic Vehicle Requirements
There are certain necessities for a truck that you need to have in place in order for it to function within Rigs of Rods. Not including certain sections can yield different results, from making the vehicle explode upon spawning, to its nonappearance in the selection menu, to crashing the game outright. Thus, it is important you get all the necessary sections in order before you go about putting in the optional ones. Read through every section of this because they're all necessary (except the cinecam and cameras sections when dealing with loads/trailers).
Your vehicle should have a file format/suffix depending on its type. The following table shows the types of vehicle and their formats.
|Vehicle Type||File Format|
For example, if I'm making a truck for Rigs of Rods, I might call it mytruck.truck, although obviously, what comes before the suffix is entirely up to you.
There are two different places to put your vehicle files.
While editing your vehicle, it is best to put it in the "vehicles" folder ("C:\Documents and Settings\Rigs of Rods\vehicles" on Windows systems). If, for example, one were creating "mytruck.truck", then one would create a folder within the "vehicles" folder called "mytruck". Within this folder, one would place "mytruck.truck" as well as all files associated with it. (meshes, material files, etc.)
When one is preparing to release a vehicle, one ought to transfer it to a zip file. This makes the file more portable and easier to release on the Rigs of Rods Repository. To make a zip file for "mytruck.truck", one would take all the files contained within "mytruck" and place them in a zip archive called "mytruck.zip". This zip can then be moved to the "Packs" folder ("C:\Documents and Settings\Rigs of Rods\Packs" on Windows systems).
You should name your vehicle before you go about doing anything else. The title must go on the very first line of the file. For example, if I want my vehicle to be called "My Truck", on Line 1 of my vehicle's file I put My Truck. Type it in as you want it to appear on the menu- there is no special syntax to worry about.
Here, we set our vehicle's mass, the mass of the load nodes and the material to be used on your vehicle. If you're planning on using a mesh, then you can just use "tracks/semi" for the material, but if you're going to use a Submesh to give your vehicle its appearance, it's a requirement.
globals ;dry mass, cargo mass, material 10000.0, 1000.0, tracks/semi
The globals section comes before the nodes and beams. The first number, called the "dry mass", in the above example, defines the mass, in kilograms, our vehicle will attempt to be. (each node has a minimum mass of 50kg.) The second number, called the "cargo mass", defines the mass of the nodes whose flag (see RoRBook/First Beams and Nodes#Nodes) is "l". These nodes are also known as the load nodes. The material, as stated above, defines the material and texture that is to be used on the submesh sections of your truck. This part of the globals is not important if you are going to make it fully out of a mesh (or multiple meshes), in which case you may simply use the material "tracks/semi".
This section is not necessary for a trailer or other load (unless you want to be able to get in your trailer or load [to activate custom flares on the trailer, for example]). It is also not necessary in airplanes or boats. In order to get into your vehicle, you will need an engine, so it's necessary for all the other vehicle types. You can find out how to use the engine section here: RoRBook/Engine
Nodes & Beams
You'll need nodes and beams - these are what make up any vehicle you see in-game. See RoRBook/First Beams and Nodes.
Cameras & Cinecam
These two sections are not at all needed if you're making a trailer or other load, unless you need to be able to enter the trailer (for example, to activate custom flares on it).
However, all the other types of vehicle do need these sections.
cameras ;centre, rear, left 0, 1, 2
The above guide image and example should prove quite helpful in creating cameras. The cameras section has to come after the nodes and beam sections, and it consists of 3 numbers. These 3 numbers are nodes that have been defined in the nodes section, and are used to define the position of the vehicle. The pitch and roll indicators (and the similar attitude indicators in aircraft), for example, use these camera nodes to get the orientation of the vehicle. It also, as the name suggests, orients the camera views.
The first node is the centre node, and it must be aligned with both the rear and the left nodes, as is visible in the guide image. The rear node must be behind the centre node, so that if you look at the vehicle from the front, the rear node is hidden by the centre node. The left node should be to the left of the centre node, so that if you look at the vehicle from the right, the left node is hidden by the centre node.
cinecam ;x, y, z, 8 bindings, spring, damping 0.66, 2.0, 1.8, 75,76,77,78,73,74,53,54, 8000.0, 800.0
The cinecam node is a node suspended with 8 beams used to define the position of the interior/first-person camera of your vehicle. Like the cameras section it must come after the nodes & beam sections.
The first 3 values define the position of the cinecam node, and are fairly self-explanatory. Like the nodes section, these values are in metres.
The next 8 values are nodes. Rigs of Rods will create beams from each of these nodes to your cinecam, in order to hold it in place.
The final 2 values define the spring and the damping factors of the beams that support your camera. The spring factor defines how stiff the beams are - the higher this number, the more stiff your camera is in terms of its position. The damping factor defines the beams' resistance to motion.
Those 2 values are optional, and if you don't include them the values will default to a spring rate of 8000.00 and a damping factor of 800.00.
The final requirement for the file is a simple three-letter word, "end". This is the very last line of your file and simply closes your vehicle file. If you don't have this, Rigs of Rods may crash or have other issues (for example, sometimes the lack of the "end" means that physics will never be calculated upon the vehicle).