Negative Scale - Maya Export

Can anyone explain to me why when I create a cube in maya, set one scale ( eg Y ) to -1 and export, the nodes transform has not only a -1 in the scale but also a 180 rotation? Is this mathematically correct? It doesn’t make sense to me.

<node id=“pCube1” name=“pCube1”>
<translate>0.000000 0.000000 0.000000</translate>
<rotate>1 0 0 180.000000</rotate>
<rotate>0 1 0 0.000000</rotate>
<rotate>0 0 1 0.000000</rotate>
<scale>1.000000 -1.000000 1.000000</scale>
<node id=“pCubeShape1” name=“pCubeShape1”>
<instance url="#pCubeShape1"/>
</node>
</node>

Stuart

It seems that its Maya’s decomposition of the matrix which is causing the problem.

If we create a cube in Maya and set the scale of X to -1, the collada file will contain a y rotation:
<rotate>0 1 0 180.000000</rotate>

If we scale in Y -1 instead of X, the collada file will contain an x rotation:
<rotate>1 0 0 180.000000</rotate>

If we scale in Z -1, the collada file will have no rotation as should be expected.

If we look in DaeDoc.cpp we find this code:

MMatrix matrix = transform.transformationMatrix();
MVector tran( matrix( 3, 0), matrix( 3, 1), matrix( 3, 2));
MEulerRotation rot; 
rot = matrix.homogenize();

When exporting the above cube, the matrix does not have any rotation, however after a call to matrix.homogenize we get the rotation appearing. Conversly, if we remove the homogenize call:

rot = matrix;

There is no problem now if the negative scale is in Y but rotations now appear for X and Z.

I don’t understand what homogenize means here, and I can’t figure out what Maya is doing. Anyone? Gordon?

The solution for now is to export the Matrix <float4x4> as is without decomposition. You simply set the fDecomposeTransforms( false) in the constructor.

Stuart