For licensing the physics technology contact licensing@rigsofrods.com

Object Format

From Rigs of Rods Wiki

Jump to:navigation, search

Contents


If you want to use LOD (Level of Detail) with your object, see this separate page: Object Format LOD

The .odef format specifies a static object that can be placed on a terrain. Those files should reside in data/objects or inside a zip file in packs folder. For example:

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 (x, y, z)
  • After that, several sections can follow (beginbox, beginmesh, playanimation)
  • The .odef file must be always closed with end

If there are no Begin box nor Begin mesh sections, the object will be throughable.

Commands

This commands can be called outside or inside a beginbox or beginmesh

  • setMeshMaterial tracks/bigsign/town 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 setMeshMaterial myRedColor. "myRedColor" is defined on any .material file you need to create.
  • drawTextOnMeshTexture 0.1, 0.6, 1, 0.3, 0, 0.8, 0, 1, l, SignFont_Big {{argument1}} see at the end of article about dynamic draws

Begin box

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 (x, y, z ) and the lower far right vertex of the box is (x1, y1, z1). If you are defining a collision box, you don't need any other optional commands, just endbox.
  • optional: virtual: this makes the box to spawn an event. In this case you must also have an event line in this box:
  • optional: event eventname filterevent
    • eventname: the name of the event it should generate. Some predefined values are shopboat, shoptruck, shopplane and spawnzone but you can define a non existing eventname if you want to use with LUA system.
    • filterevent: on what it should trigger. valid values: avatar, truck, airplane.
  • optional:direction 0, 90, 0: this determines the direction of objects spawned in this box
  • optional:camera x, y, z: Coordinates to place the camera.
  • optional: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.
  • optional:stdfriction name where name is either concrete, asphalt, gravel, rock, ice, snow, metal, grass or sand: this will set the type of friction the collision box will do. The physical parameters of these standard friction materials are defined if the configuration file ground_models.cfg. See Ground models for more information.
  • optional: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. See Ground models for more information.
  • 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 avatar (RoRbot) enter in the box specifies by boxcoords, a trigger 'shopplane' will be triggered, so Truck ingame menu will be shown.

Begin mesh

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

Animations

If your object has an animation you can play it with this additional line:

  • playanimation speedfactorMin speedfactorMax AnimationName

notes: those objects wont be collide-able, also the animation will loop forever

Dynamic Draw

It allow to create a speed sign (for example) without the number speed limit. When you add the object to the terrain, you will pass an argument (speed limit number) that RoR will draw on it.

see on details: Dynamic Signs


particleSystem

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