if i have a vector with rotation (0,0,0) in x,y,z, if i want to move forward, i change the z coordenate. this isn't so easy when i have rotation. for example. if i want to go in the direction of a vector that it have, and the vector is rotated. how can i to change the coordenates for moving in the direction of vector?????.
thanks
problems with vectors
if your direction vector is directionVector and the vector that stores the rotation of directionVector is rotationVector try this:
core::vector3df zeroVect=core::vector3df(0.0,0.0,0.0);
directionVector.rotateYZby(rotationVector.X,zeroVect);
directionVector.rotateXZby(rotationVector.Y,zeroVect);
directionVector.rotateXYby(rotationVector.Z,zeroVect);
this code rotate the direction by rotationVector.
Anyway if the rotationVector is the rotation of the camera,this code doesn't seem to work.
For example if your directionVector is (0,0,1),the rotationVector is camera->getRotation() and you want to walk forward,you have to change the third line with directionVector.rotateXZby(-rotationVector.Y,zeroVect);
core::vector3df zeroVect=core::vector3df(0.0,0.0,0.0);
directionVector.rotateYZby(rotationVector.X,zeroVect);
directionVector.rotateXZby(rotationVector.Y,zeroVect);
directionVector.rotateXYby(rotationVector.Z,zeroVect);
this code rotate the direction by rotationVector.
Anyway if the rotationVector is the rotation of the camera,this code doesn't seem to work.
For example if your directionVector is (0,0,1),the rotationVector is camera->getRotation() and you want to walk forward,you have to change the third line with directionVector.rotateXZby(-rotationVector.Y,zeroVect);