Object format (.odef)¶
.odef format specifies a static object that can be placed on a terrain. These files are placed in the same zip as the object's mesh files. Rigs of Rods will not load the object if the file does not exist!
Basic example with a collision mesh:
Building.mesh 1, 1, 1 beginmesh mesh BuildingCollision.mesh endmesh end
Advanced example file featuring event boxes:
hangar.mesh 1, 1, 1 beginmesh mesh hangar.mesh endmesh beginbox boxcoords -23.75, -21.75, -0.2, 2.1, -3.07, -0.19 virtual event shopplane avatar endbox beginbox boxcoords -17, 17, 0, 4.5, -29, 4 virtual event spawnzone direction 0, 90, 0 endbox end
The format is described below:
The first line specifies the visual mesh to use
The second line specifies the scale of it (
After that, several sections can follow (
.odef file must be always closed with
If there are no Begin box nor Begin mesh sections, the object will be throughable.
These commands can be called outside or inside a
You can create different materials (red, blue, green skins) for your object and now, you only need to create 3 different
.odef files, one for each color.
For example you create a file called
myRedBuilding.odef and inside you specify
myRedColor is defined on any
.material file you need to create.
Disables shadow casting for the object. Useful for skyboxes.
Building.mesh 1, 1, 1 beginmesh mesh BuildingCollision.mesh endmesh nocast end
Specifies a box that can be used for collisions or events.
boxcoords x, x1, y, y1, z, z1 where the upper near left vertex of the 3D box is (
z) and the lower far right vertex of the box is (
z1). If you are defining a collision box, you don't need any other optional commands, just
virtual: this makes the box to spawn an event. In this case you must also have an event line in this box:
event eventname filterevent
eventname: the name of the event it should generate.
Some predefined values are
spawnzone but you can define a non existing eventname if you want to use with Angelscript.
filterevent: on what it should trigger. valid values:
direction 0, 90, 0: this determines the direction of objects spawned in this box
camera x, y, z: Coordinates to place the camera.
forcecamera x, y, z: Coordinates to place the camera, and force to change to this camera point of view when player enter at the box coords.
Loads a custom groundmodel config. Use this if you want to use a groundmodel not specified in
name-groundmodel.cfg is the name of your groundmodel config file.
name is either
sand: this will set the type of friction the collision box will do. The physical parameters of these standard friction materials are defined in the configuration file
friction adhesion velocity, static friction coef, dynamic friction coef, hydrodynamic coef, Stribeck velocity, alpha, strength, fx_type, [fx_color]: this will set the parameters of the friction the collision box will do. The physical parameters are manually given.
endbox must close the box
beginbox boxcoords -23.75, -21.75, -0.2, 2.1, -3.07, -0.19 virtual event shopplane avatar endbox
Whenever the character (RoRbot) enters the box specifies by boxcoords, a trigger
shopplane will be triggered, so the spawn menu will be shown.
You can use a existing mesh that RoR collision system will use.
beginmesh: this enables you to use meshes for collisions:
mesh hangar.mesh: this load the mesh hangar.mesh as a collision mesh. Important: Only use very low polygon meshes, or the simulation will be slowed down drastically!
endmesh: closes the actual mesh box
You can also use the option
stdfriction with this syntax.
For example, if you have made a road object in 3D and you want to give it an asphalt friction, give it an odef file like this one:
mr_road.mesh 1, 1, 1 beginmesh mesh mr_road.mesh stdfriction asphalt endmesh end
If your object has an animation you can play it with this additional line:
playanimation speedfactorMin speedfactorMax AnimationName
Example from the terrain Fall Run:
playanimation 0.5, 0.6, CAT_330c_diging
Notes: These objects wont be collide-able, and the animation will loop forever
You can add chimneys or other particle effects to your object using this:
;particleSystem scale, x, y, z, particleInstanceName particleScriptName particleSystem 1, 1, 1, 1, myfire1 enhancedFire