Closed for Company Meetings: Between September 18 (5pm PDT) and September 22 (12pm PDT), Support and Sales requests *will be delayed*. Only time-sensitive issues will be addressed during that time. Thanks for your patience.

Sep 06 2012 | 6:12 pm

it seems that the order of rotation used in jit.euler2quat is YZX:
first X rot, second Z rot, third Y rot
so X is the bank (tilt) axe.

there is 12 rotation order possibilities.

A convenient order of rotation for openGL, when object is facing the camera is YXZ:
first Z rot, second X rot, third Y rot
It is more logical to use this order, respect to the direction and lookat attributes of jit.anim.node that use the Z axis of the object.
so Z is the bank (tilt) axe.

Could you create an attribute for those 2 objects like: rotation_order (default: yzx, yxz etc...)
or make an object like jit.eulerYXZ2quat and jit.quat2eulerYXZ
or perhaps send me or make the code public for jit.euler2quat & jit.quat2euler, so i can adapt them.

thanks

I created a mxj for this:

public final void yxz_r(double x, double y, double z) {
// Y : heading, X : attitude, Z : bank
// enter: XYZ _ order process: YXZ
// first Z rot, second X rot, third Y rot, for jitter conveniences
// Assuming the angles are in radians.

double sx = Math.sin(x/2);
double cx = Math.cos(x/2);
double sy = Math.sin(y/2);
double cy = Math.cos(y/2);
double sz = Math.sin(z/2);
double cz = Math.cos(z/2);

// R= Qx*Qz _ first Zrot then Xrot
// double Rx = cz*sx;
//double Ry = -sz*sx;
//double Rz = sz*cx;
//double Rw = cz*cx;

// R= Qy*Qxz first XZrot then Yrot
//qx = Rx*cy+Rz*sy;
//qy = Rw*sy+Ry*cy;
//qz = -Rx*sy+Rz*cy;
//qw = Rw*cy-Ry*sy;

// R= Qy*Qx*Qz first Zrot then Xrot then Yrot
qx = cz*sx*cy+sz*cx*sy;
qy = cz*cx*sy-sz*sx*cy;
qz = -cz*sx*sy+sz*cx*cy;
qw = cz*cx*cy+sz*sx*sy;

quat_out();
}