I’m working on a simulation and wanted to use Blender to do the simple models required. I built up a simple tank with body, turret, and barrel to test out the concept. I’d like to export each object to a seperate .X file so that my program can control the rotation of each element relative to it’s parent. However when I use “Only selected object” from the DX8 Exporter I get a set of mesh vertexes that are positioned with regards to the parent object’s axis with scaling and rotation in addition to translation. Before I go off and write a new version of the exporter, is there a way in Blender to apply the object’s matrix to the mesh data’s vertex’s so that the object’s matrix is reduced to a pure translation. If there is a tutorial on a better way to get my articulated simulation into DirectX9 I’m open to that as well.
Thanks,
Brian
Here is an example of the problem from an exported .X file of the cube in a new blender file:
Frame Cube {
FrameTransformMatrix {
1.0,0.0,0.0,0.0,
0.0,1.0,0.0,0.0,
0.0,0.0,-1.0,0.0,
0.0,0.0,0.0,1.0;;
}
Mesh {
24;
1.0; 0.999999940395; -1.0;,
1.0; -1.0; -1.0;,
-1.00000011921; -0.999999821186; -1.0;,
-0.999999642372; 1.00000035763; -1.0;,
1.00000047684; 0.999999463558; 1.0;,
-0.999999940395; 1.0; 1.0;,
-1.00000035763; -0.999999642372; 1.0;,
0.999999344349; -1.00000059605; 1.0;,
1.0; 0.999999940395; -1.0;,
1.00000047684; 0.999999463558; 1.0;,
0.999999344349; -1.00000059605; 1.0;,
1.0; -1.0; -1.0;,
1.0; -1.0; -1.0;,
0.999999344349; -1.00000059605; 1.0;,
-1.00000035763; -0.999999642372; 1.0;,
-1.00000011921; -0.999999821186; -1.0;,
-1.00000011921; -0.999999821186; -1.0;,
-1.00000035763; -0.999999642372; 1.0;,
-0.999999940395; 1.0; 1.0;,
-0.999999642372; 1.00000035763; -1.0;,
1.00000047684; 0.999999463558; 1.0;,
1.0; 0.999999940395; -1.0;,
-0.999999642372; 1.00000035763; -1.0;,
-0.999999940395; 1.0; 1.0;;
6;
4; 0, 3, 2, 1;,
4; 4, 7, 6, 5;,
4; 8, 11, 10, 9;,
4; 12, 15, 14, 13;,
4; 16, 19, 18, 17;,
4; 20, 23, 22, 21;;
After I rotate it 45 deg, the vertices are still the same, only the transform maxtrix for the frame has been changed…
Frame Cube {
FrameTransformMatrix {
1.0,0.0,0.0,0.0,
0.0,0.7069,0.7074,0.0,
0.0,0.7074,-0.7069,0.0,
0.0,0.0,0.0,1.0;;
}
Mesh {
24;
1.0; 0.999999940395; -1.0;,
1.0; -1.0; -1.0;,
-1.00000011921; -0.999999821186; -1.0;,
-0.999999642372; 1.00000035763; -1.0;,
1.00000047684; 0.999999463558; 1.0;,
-0.999999940395; 1.0; 1.0;,
-1.00000035763; -0.999999642372; 1.0;,
0.999999344349; -1.00000059605; 1.0;,
1.0; 0.999999940395; -1.0;,
1.00000047684; 0.999999463558; 1.0;,
0.999999344349; -1.00000059605; 1.0;,
1.0; -1.0; -1.0;,
1.0; -1.0; -1.0;,
0.999999344349; -1.00000059605; 1.0;,
-1.00000035763; -0.999999642372; 1.0;,
-1.00000011921; -0.999999821186; -1.0;,
-1.00000011921; -0.999999821186; -1.0;,
-1.00000035763; -0.999999642372; 1.0;,
-0.999999940395; 1.0; 1.0;,
-0.999999642372; 1.00000035763; -1.0;,
1.00000047684; 0.999999463558; 1.0;,
1.0; 0.999999940395; -1.0;,
-0.999999642372; 1.00000035763; -1.0;,
-0.999999940395; 1.0; 1.0;;
6;
4; 0, 3, 2, 1;,
4; 4, 7, 6, 5;,
4; 8, 11, 10, 9;,
4; 12, 15, 14, 13;,
4; 16, 19, 18, 17;,
4; 20, 23, 22, 21;;