Prefab

Prefab is xml file with description of game object. It contains 3D-model, its materials (textures), collisions, etc. It contains several sections. Most of them are optional.

Header section
It is just definition of xml version. Required section.

&lt;? xml version = "1.0" ?>

Model section
Model block is the main part of prefab description. It contains fullpath for model (*.mim file) and one or several material that it used (*.mtl file)

&lt; model res = "mods\938362548\hangar.mim" > &lt; mat id = "1" res = "materials\big_brick.mtl" /> &lt; mat id = "2" res = "materials\WoodBalks2.mtl" /> &lt;/ model >

Optionally prefab can contains one or several lod blocks. It describes model that will be used at the given LOD (level of detail) instead of original model. And do it in the same manner as model block but also introduces distance attribute that mean minimum distance from the camera to model for this LOD.

&lt; lod res = "mods\938362548\hangarLOD.mim" distance = "60" > &lt; mat id = "1" res = "materials\big_brick.mtl" /> &lt; mat id = "2" res = "materials\WoodBalks2.mtl" /> &lt;/ lod >

There also special case for LOD without any model (it is useful when camera is too far to see any details):

&lt; lod res = "" distance = "400" > &lt;/ lod >

Collision section
Collision section markup passable zones by setting invisible walls to workers and other objects.

There are two ways to set collision:


 * By setting MIC file:

&lt; collision res = "mods\938362548\hangarFloor.mic" />


 * By setting one or several col_line blocks. Each pair of numbers in this block is 2-dimensional point that mean local coordinate of model. The sequence of this points forms line (or invisible wall) for workers:

&lt; col_line > 1 -0.5 1.5 -0.5 1.5 -1.5 -1 -1 &lt;/ col_line >

Pivot section
Pivot is combination of 3D position and direction (unit vector). Pivots are used for various purposes such as specifying location (and direction) of worker animation during building and so on.

&lt; pivot name = "Build_001" pos = "1.85 -0.5" dir = "-0.931087 0 -0.364798" /> &lt; pivot name = "Build_002" pos = "1.5 -2.0" dir = "-0.553191 0 0.833054" /> &lt; pivot name = "Build_003" pos = "-1.5 -2.0" dir = "0.486056 0 0.873928" />

Example
[Download prefab example]