Adding an object to a terrain
From Rigs Of Rods
(→Step 1: Creating an Ogre mesh and texture) |
|||
(2 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
This tutorial in in two part: | This tutorial in in two part: | ||
- | |||
- | |||
- | + | * If you want to model a new object from scratch, start from the beginning. | |
- | If you want to model | + | * If you want to add an existing game object, start from step 3 or 4 if the object is already in the edition list. |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | comment4, | |
== Step 2: Creating an odef object file == | == Step 2: Creating an odef object file == | ||
To make the mesh usable, you must create a .odef text file, also in the data/objects. | To make the mesh usable, you must create a .odef text file, also in the data/objects. | ||
+ | |||
The main role of the odef it to declare the collision volumes. | The main role of the odef it to declare the collision volumes. | ||
+ | |||
The simplest odef file is : | The simplest odef file is : | ||
<pre> | <pre> | ||
Line 40: | Line 20: | ||
The first line is the filename of the .mesh, the second is the x,y,z scale factor to apply to the object. | The first line is the filename of the .mesh, the second is the x,y,z scale factor to apply to the object. | ||
+ | |||
The file ends with "end". Collision boxes are optional. | The file ends with "end". Collision boxes are optional. | ||
+ | |||
To add collision volumes, just add lines after the scale factor. | To add collision volumes, just add lines after the scale factor. | ||
+ | |||
A collision volume is a box. You can optionnaly rotate the box. | A collision volume is a box. You can optionnaly rotate the box. | ||
+ | |||
The syntax of a collision line is: | The syntax of a collision line is: | ||
+ | |||
minX, maxX, minY, maxY, minZ, maxZ [, rotX, rotY, rotZ] | minX, maxX, minY, maxY, minZ, maxZ [, rotX, rotY, rotZ] | ||
+ | |||
with minX<maxX, minY<maxY, minZ<maxZ defining the collision planes of the box, relative to the center of the mesh (as definined in your modeler). | with minX<maxX, minY<maxY, minZ<maxZ defining the collision planes of the box, relative to the center of the mesh (as definined in your modeler). | ||
Line 62: | Line 48: | ||
In order to be able to position an .odef object in the game with the truck, you must add it to the list of objects the truck will use. This list is the "editor.cfg" file in the RoR directory. | In order to be able to position an .odef object in the game with the truck, you must add it to the list of objects the truck will use. This list is the "editor.cfg" file in the RoR directory. | ||
+ | |||
Just add '''the name of the odef file without the .odef extension'''. | Just add '''the name of the odef file without the .odef extension'''. | ||
+ | |||
for example | for example | ||
<pre> | <pre> | ||
Line 80: | Line 68: | ||
To position an object (declared in the editor.cfg list) in the terrain, start RoR, and select the terrain editor truck. | To position an object (declared in the editor.cfg list) in the terrain, start RoR, and select the terrain editor truck. | ||
+ | |||
Enter the truck, and press V to cycle thru the objects in the list. The object will be at the end of the crane of the truck. | Enter the truck, and press V to cycle thru the objects in the list. The object will be at the end of the crane of the truck. | ||
+ | |||
Move the crane to position the object where you like it. | Move the crane to position the object where you like it. | ||
+ | |||
Press the Ins, Del, Home, End keys to rotate the object as you like. | Press the Ins, Del, Home, End keys to rotate the object as you like. | ||
+ | |||
When everything is set, press the space bar. This will create the new object. | When everything is set, press the space bar. This will create the new object. | ||
+ | |||
You can continue and place several different objects at different places. | You can continue and place several different objects at different places. | ||
Current revision as of 18:50, 3 March 2009
This tutorial in in two part:
- If you want to model a new object from scratch, start from the beginning.
- If you want to add an existing game object, start from step 3 or 4 if the object is already in the edition list.
comment4,
Contents |
[edit] Step 2: Creating an odef object file
To make the mesh usable, you must create a .odef text file, also in the data/objects.
The main role of the odef it to declare the collision volumes.
The simplest odef file is :
your_object.mesh 1.0, 1.0, 1.0 end
The first line is the filename of the .mesh, the second is the x,y,z scale factor to apply to the object.
The file ends with "end". Collision boxes are optional.
To add collision volumes, just add lines after the scale factor.
A collision volume is a box. You can optionnaly rotate the box.
The syntax of a collision line is:
minX, maxX, minY, maxY, minZ, maxZ [, rotX, rotY, rotZ]
with minX<maxX, minY<maxY, minZ<maxZ defining the collision planes of the box, relative to the center of the mesh (as definined in your modeler).
Example:
road.mesh 1, 1, 1 0, 10, -5, 0, -3, 3 0, 10, -5, -0.5, -4.5, 4.5 0, 10, -0.7635, -0.2365, -4.4572, -2.8761, -18.4349, 0, 0 0, 10, -0.7635, -0.2365, 2.8761, 4.4572, 18.4349, 0, 0 end
This is the collision boxes of a block of road. The first two lines are simple boxes, the other two are rotated boxes (to do the sloped sides of the road).
[edit] Step 3: Adding the object to the edition list
In order to be able to position an .odef object in the game with the truck, you must add it to the list of objects the truck will use. This list is the "editor.cfg" file in the RoR directory.
Just add the name of the odef file without the .odef extension.
for example
;objects that are selectable with the editor truck your_object sign-leftturn sign-rightturn sign-bump sign-crossing sign-descent sign-fall sign-rocks sign-warning
[edit] Step 4: Positionning the objects with the terrain editing truck
To position an object (declared in the editor.cfg list) in the terrain, start RoR, and select the terrain editor truck.
Enter the truck, and press V to cycle thru the objects in the list. The object will be at the end of the crane of the truck.
Move the crane to position the object where you like it.
Press the Ins, Del, Home, End keys to rotate the object as you like.
When everything is set, press the space bar. This will create the new object.
You can continue and place several different objects at different places.
Do not press B or you won't be able to add new objects!
[edit] Step 5: Making the changes permanent
The objects you just created are not permanent. To make them permanent, open the "editor_out.txt" file in the RoR directory, copy the content of this file and paste it in the proper .terrn file, before the last line that contains "end".