Original Post
I am working with the Cipher Graphics engine, and Tokamak physics engine.
My Cipher game code is using a coord system where Z is the up/down axis
The Tokamak coord system is setup so Y is the up/down axis
So I need to convert the axis info I''m getting from tokamak to be compatabile with the coords of my game code.
During each frame I get the position and rotate info from tokamak in the following format.
neT3 t
t.rot[0][0]; // X rotation
t.rot[0][1];
t.rot[0][2];
t.rot[1][0]; // Y rotation
t.rot[1][1];
t.rot[1][2];
t.rot[2][0]; // Z rotation
t.rot[2][1];
t.rot[2][2];
t.pos[0]; // XYZ Position
t.pos[1];
t.pos[2];
I''ve heard tell, that in order to convert my data from a Y up system to a Z up system, I simply need to rotate about the X access 90 degrees.
I have a math lib function which works pretty much the same as glRotate(). This function is called mat4_Rotate and is defined as
/*
==========================
mat4_Rotate
Adds in a rotation of angle degrees about the
vector x, y, z to the matrix, similar to glRotate
==========================
*/
void mat4_Rotate(float angle, float x, float y, float z, mat4_t m)
Now for the question, How the hell do i use this fuctino to do it.
I''ve assume that I simply fill in the (mat4_t m) matrix with the data i get from tokamak. Like so.
m[0] = t.rot[0][0];
m[1] = t.rot[0][1];
m[2] = t.rot[0][2];
m[3] = 0;
m[4] = t.rot[1][0];
m[5] = t.rot[1][1];
m[6] = t.rot[1][2];
m[7] = 0;
m[8] = t.rot[2][0];
m[9] = t.rot[2][1];
m[10] = t.rot[2][2];
And then rotate ......
mat4_Rotate(90, 1, 0, 0, m);
I then simply update my game code with the updated matrix (m)
.........
.......
Obviously since i writing this, its not really working out for me.... Is there some obvious that i am doing wrong?