I am trying to extract the forward vector from 4x4 transformation matrix.
I have two forms of calculation one is for nodes in the scene graph and other is for camera.
This is how I calculate transformation matrix for node.
Code :// Matrix44 is a float Matrix44 nodeTranslationMat; // translation matrix for node Matrix44 nodeRotationMat; // rotation matrix for node Matrix44 transformationMatrix= nodeTranslationMat* nodeRotationMat; // transformation matrix
And this is how I do it for camera
Code :Matrix44 cameraTranslateMat; // translation matrix for camera Matrix44 cameraRotationMat; // rotation matrix for camera Matrix44 transformationMatrix= cameraRotationMat* cameraTranslateMat; // transformation matrix, note - multiplication order is different form node
And then for the camera forward vector I can extract using above transformation matrix like
Code :Vector3f forwardVector = Vector3f(transformationMatrix, transformationMatrix, transformationMatrix);
But If I do this above to find the forward vector for node it's not works.
Could you please help me to find it it?