I've been reading up on how to use matrices because they appear to be easiest way to transform your nodes once you figure them out (especially when needing to do a series of transformations). I plan on doing a lot of rotation around various axis (not just x,y,z). So I'm thinking matrix is the way to go. However, I was not getting the results I liked so I tried a very simple operation and found that either they are broke or I'm not doing something right. Here is some example code.
Code: Select all
//create matrix and sample vector
matrix4 mat;
vector3df rot=vector3df(0,1,0); //rotated 1 degree on y-axis
//set the rotation transformation
mat.setRotationDegrees(vector3df(0,90,0));
//Apply the transformation
mat.transformVect(rot);
//update player rotation
player->setRotation(rot); //should equal (0,91,0) right?
Well the result of this is (0,1,0) i.e. it does nothing. I tried doing mat.makeIdentity() first and that had no effect. I also tried the setRotationRadians() version and that had no effect. Has anyone else tried using the irrlicht matrix functions?