"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

How to get camera position/orientation from pose matrix.

I found this thread discussing this question, and I noticed this set of postings:

lydesik:

my matrix are ROW_MAJOR here are my matrixes modelViewMatrix

0.998775 -0.007211 0.048951 0.000000

-0.006447 -0.999855 -0.015741 0.000000

0.049058 0.015406 -0.998677 0.000000

0.085168 -0.049039 1.303295 1.000000

inverseModelViewMatrix

0.998775 -0.007211 0.048951 -0.149216

-0.006447 -0.999855 -0.015741 -0.027968

0.049058 0.015406 -0.998677 1.298148

0.000000 0.000000 0.000000 1.000000

here is the code i'm using to print the matrix

void printMATRIX4X4(MATRIX4X4& matSrcMatrix) { MATRIX4X4* s = &matSrcMatrix; LOGI(

"%f %f %f %f",s->M(0,0), s->M(0,1), s->M(0,2), s->M(0,3));

LOGI("%f %f %f %f",s->M(1,0), s->M(1,1), s->M(1,2), s->M(1,3));

LOGI("%f %f %f %f",s->M(2,0), s->M(2,1), s->M(2,2), s->M(2,3));

LOGI("%f %f %f %f",s->M(3,0), s->M(3,1), s->M(3,2), s->M(3,3));

ksiva:

So if you look at your inverse modelview matrix, the 3rd column should be the camera lookAt and the 4th column should be the camera position. Pull those values out however you'd like! - Kim

 

In my application, I set the camera to the transpose of the projection and pose matrices every frame. This has been working for me, but in my game engine, the camera's position isn't updated when using matrices directly, so I need to be able to get the cameras position and orinetation/look at from these matrices. I tried setting the cameras position and look at with the 3rd and 4th columns of the inverse of the pose matrix, but that doesn't work as expected. Any help?

I noticed that the values for y seem to be reversed when using the method that gets the translation for the camera from the inverse of the model view matrix. When I move the physical camera up the y axis, the y values are getting lower.