CuteAlien wrote:Hehe - check that matrix4.h file some more, M is even explained in there
("//! Matrix data, stored in row-major order")
Thanks, dude, I think I finally obtained what I was looking for...
Just to summarise my thoughts, let consider again the code I posted above (assuming currentRotation and coordinates two vector3df objects respectively containing the rotation of a 3D body around the three axis and its coordinates; m a CMatrix4; distance a float variable):
Code: Select all
vel = vector3df(0.0f, 0.0f, distance);
m.setRotationDegrees(currentRotation);
m.transformVect(vel);
coordinates += vel;
m.setRotationDegrees(currentRotation) calls in turn setRotationRadians and assigns values to m[0], m[1], m[2], m[4], m[5], m[6], m[8], m[9], m[10] (I believe m[3], m[7], m[11+] are = 0, am I right?).
m.transformVect(vel) transforms vel in the following way (in my scenario m[12], m[13] and m[14] are equal to 0, as well as vel.X and vel.Y, thus I've removed all of these factors from the formulas below):
vel.X = vel.Z * m[8]
vel.Y = vel.Z * m[9]
vel.Z = vel.Z * m[10]
The new coordinates are then calculated simply as coordinates + vel.
In other terms (if my above considerations are correct) I might conclude that:
coordinates(t+1) = coordinates(t) + distance * (vel.Z * m[8], vel.Z * m[9], vel.Z * m[10]).
Hope I haven't written too much bullshit...