How to export collision model in a free time project?

In a free time project, how do you export collision models? I have run into this problem at cubson GUI Force development. Each designer who had joined to a project has different 3D tools from each other — Maya, XSI, Max and Blender. Normally, to export collision models, programers have to develop a exporter plug-in. But, that’s impossible in this case, because tools of designers are not unified. Programers could not buy all tools who is owned by each designer, for a free time project.

In cubson GUI Force, staff of the project exported the collision model as .X format. Programers parsed .X format, fetched vertexes and used those for hit and undulation. However, some of tools exported binary .X file, so programers had to make two kinds of the converter. In addition, .X format is flexible very much and was impossible to convert sometimes.

Then I have researched a better way and focused attention on COLLADA format. COLLADA is text base, XML format, easy to parse, and contains vertexes directly, unlike DXF. Designers need to convert collision models to polygon before. Especially, converted triangle polygon is useful as a collision model.

Here is an example in XSI Mod Tool 6. Choose File > Crosswalk > Export.

Choose “COLLADA 1.4.1” in Crosswalk Filetype. Input File name. Lastly click Export button.

Then, you may get dae file including clear geometry data. The following geometry data is exported from a primitive box.

  <library_geometries>    <geometry id="geometries_0">      <mesh>        <source id="geometries_0-Pos">          <float_array id="geometries_0-Pos-array" count="24">            ......          </float_array>          <technique_common>            <accessor source="#geometries_0-Pos-array" count="8" stride="3">              ......            </accessor>          </technique_common>        </source>        <vertices id="geometries_0-Vtx">          <input semantic="POSITION" source="#geometries_0-Pos"/>        </vertices>        <polylist count="6" material="Scene_Material">          <input semantic="VERTEX" source="#geometries_0-Vtx" offset="0"/>          <vcount>            ......          </vcount>          <p>            ......          </p>        </polylist>      </mesh>      <extra>        <technique profile="XSI">            <XSI_VertexList>              <xsi_param sid="Attributes"> </xsi_param>              <xsi_param sid="nbAttributes">8 </xsi_param>              <xsi_param sid="position">0 1 2 3 4 5 6 7</xsi_param>            </XSI_VertexList>        </technique>      </extra>    </geometry>  </library_geometries>

The geometry element contains vertecies and indecies. Souce elements contains positions of vertex.

<source id="geometries_0-Pos">  <float_array id="geometries_0-Pos-array" count="24">    -0.500000 -0.500000 -0.500000     0.500000 -0.500000 -0.500000     -0.500000 0.500000 -0.500000     0.500000 0.500000 -0.500000     -0.500000 -0.500000 0.500000     0.500000 -0.500000 0.500000     -0.500000 0.500000 0.500000     0.500000 0.500000 0.500000  </float_array>  <technique_common>    <accessor source="#geometries_0-Pos-array" count="8" stride="3">      <param name="X" type="float"/>      <param name="Y" type="float"/>      <param name="Z" type="float"/>    </accessor>  </technique_common></source>

Polylist elements contains count of face and indecies. I didn’t divide a primitive box to triangle, so the faces of the following is 4 vertecies.

<polylist count="6" material="Scene_Material">  <input semantic="VERTEX" source="#geometries_0-Vtx" offset="0"/>  <vcount>    4 4 4 4     4 4  </vcount>  <p>    0     2     3     1     0     1     5     4     0     4     6     2     1     3     7     5     2     6     7     3     4     5     7     6  </p></polylist>

So COLLADA is very simple file format, it’s useful for free time project case in which we need to develop export plugin for many 3D tools. However, you may not export specific objects to COLLADA in some tools. That’s inconvenient, because a game scene has both of geometry and collision normally. FBXConverter is able to convert FBX to COLLADA. If your tool can export specific objects to FBX, FBXConverter may be useful for your environment.

Advertisements
This entry was posted in Game Engine and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s