Path: chuka.playstation.co.uk!news From: "Markus Tesche" Newsgroups: scee.yaroze.programming.3d_graphics Subject: Quaternion 2 Matrix ... Date: Sat, 22 May 1999 11:17:48 +0200 Organization: PlayStation Net Yaroze (SCEE) Lines: 67 Message-ID: <7i5ssl$lic4@chuka.playstation.co.uk> NNTP-Posting-Host: han-145-253-94-108.arcor-ip.net X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Hi guys, I have a little question about the Matrix-Format, the Yaroze uses .... I use my routines (working with Direct3D and little modified for OpenGL) to store some AnimationKeys using Quaternions. The Problem is, if I use the standart Quaternion2Matrix function on the Yaroze, the result RotationMatrix does not the same as on DirectX or OpenGL, it rotates sometimes not correct !! I checked all, the code to store, the result and so on and know I´m thinking about that the Yaroze uses the Matrix not the same as on Direct3D or OpenGL ... does anyone know this Problem or does anyone tried to store AnimKeys using Quaternions on the PSX ?? Or is it possible that the Matrix works not correct because of the inverse Y ?? OK, here look at the Code right now #define ONEsqr 16777216 // ONE * ONE void Quaternion2Matrix(QUAT* quat, MATRIX* M) { long wx, wy, wz, xx, yy, yz, xy, xz, zz, x2, y2, z2; x2 = quat->x + quat->x; y2 = quat->y + quat->y; z2 = quat->z + quat->z; xx = quat->x * x2; xy = quat->x * y2; xz = quat->x * z2; yy = quat->y * y2; yz = quat->y * z2; zz = quat->z * z2; wx = quat->w * x2; wy = quat->w * y2; wz = quat->w * z2; M->m[0][0] = (ONEsqr - (yy + zz)) / ONE; M->m[0][1] = (xy + wz) / ONE; M->m[0][2] = (xz - wy) / ONE; M->m[1][0] = (xy - wz) / ONE; M->m[1][1] = (ONEsqr - (xx + zz)) / ONE; M->m[1][2] = (yz + wx) / ONE; M->m[2][0] = (xz + wy) / ONE; M->m[2][1] = (yz - wx) / ONE; M->m[2][2] = (ONEsqr - (xx + yy)) / ONE; M->t[0] = 0; M->t[1] = 0; M->t[2] = 0; } OK, thanks, Bye MT