I'm trying to rotate a 3D object around its own axises.
I have some delta value which is added to... look at the code(this is onMouseMoveEvent):
Code:
float tx; float ty; float tz; float rx; float ry; float rz; float sx; float sy; float sz;
h3dGetNodeTransform(*i, &tx, & ty, & tz, & rx, & ry, & rz, & sx, & sy, & sz);
h3dSetNodeTransform(*i, tx, ty, tz, rx+delta, ry, rz, sx, sy, sz);
Everything is good for Y and Z axises, but not for X. The object rotates only for 180 degrees and stops.
So I debugged and seen that when -90 < rx < 90, ry == 0 and rz == 0
but when rx passes this border, ry and rz are changed automatically: ry == 180 and rz == 180
and my code
Code:
h3dSetNodeTransform(*i, tx, ty, tz, rx+delta, ry, rz, sx, sy, sz);
now performs rotation in reverse direction...
How can I handle it?