# Rotation Order

Hello,

does someone know what the rotation order is? I built a Collada exporter and it demands…

1 0 0 xAngle

0 1 0 yAngle

0 0 1 zAngle

…in a specific order. I have tried all but don’t come to the correct result.

Thanks a lot.

Regards,

Equi

Maybe you don’t consider the whole transform (e.g. a rotation and location of a child both influence each other)

Hello,

The COLLADA part looks like this

[xml]

<node id=“671805357862912-Node” name=“Dreifachbindung” type=“NODE” layer=“default”>

<translate>3.0078955 3.0078955 0.78576815</translate>

<rotate sid=“rotationZ”>0 0 1 46.38720242738492</rotate>

<rotate sid=“rotationY”>0 1 0 -6.8159080982319</rotate>

<rotate sid=“rotationX”>1 0 0 -10.084933965195676</rotate>

<scale>1.0 1.0 1.0</scale><instance_geometry url="#671805357862912"/>

</node>

[/xml]

The “node” is the Geometry spatial of JME. The translate values are the values obtained from…

[java]

geometry.getLocalTranslation();

[/java]

The rotation values are obtained from…

[java]

float[] angles=new float[3];

angles=geometry.getLocalRotation().toAngles(angles);

[/java]

As far as I understand, there must be a rotation order within JME engine, e.g. Euler Angles, which means z-rotation, new y axis y’ y-rotation, new z-axis z’’ z-rotation.

Thanks.

Regards,

Equi

Rotation in jme is well documented in the javadoc and wiki, what you need to understand is how the rotation in the collada file is expected to work.

For what it’s worth, I understand your question… I just don’t know the answer. And really, if I needed to know then I would just experiment a little and/or look in the code… or both.

Especially since I almost always get it backwards the first time even when I do know.

And note: from my experience it is further complicated by the fact that I’ve found the fromAngles() and toAngles() javadoc to be wrong. At least, nearly predictably I treat it as “rotation about X”, “rotation about Y”, and “rotation about Z” even though the docs say yaw, pitch, and roll.

Hello,

got it…

[xml]

<node id="671805357862912-Node" sid="671805357862912-Node" name="Dreifachbindung" type="NODE" layer="default">

<translate>-1.0141463 0.3157304 -0.33895862</translate>

<rotate sid="rotationY">0.0 1.0 0.0 197.08624</rotate>

<rotate sid="rotationZ">0.0 0.0 1.0 337.74408</rotate>

<rotate sid="rotationX">1.0 0.0 0.0 186.64034</rotate>

<scale>1.0 1.0 1.0</scale><instance_geometry url="#671805357862912"/>

</node>

[/xml]

So, JME Euler Angles y->z->x with axes (0,1,0)->(0,0,1)->(1,0,0) are mapped to COLLADA Euler Angles z->y->x with axes (0,0,1)->(0,1,0)->(1,0,0), i.e. y and z axes are switched between JME and COLLADA.

Thanks.

Regards,

Equi