Start a new topic

how to get cam position?

hey wikitide support,

     I am making an app that uses the instant tracking that needs the cameras position. as I understand you first mark your starting point and from there the camera moves in respect to that starting point


so cam does have a pos (x, y, z) and a (x, y ,z) rot


how do i access it?


i am developing in cordova 


thanks in advance,

      Pascal


Hi Yannick,



the translation vector extracted in the code snippet I posed previously already is the camera position in the coordinate system of the target. No need for any further calculations.



- Daniel


Apparently to get the actual eye coordinates I had to invert the view matrix

source: https://gamedev.stackexchange.com/questions/22283/how-to-get-translation-from-view-matrix


Android code snippet:

float[] invertedViewMatrix = new float[16];
Matrix.invertM(invertedViewMatrix, 0, viewMatrix, 0);
final Vector3<Float> eyeCoords = new Vector3<>(invertedViewMatrix[12], invertedViewMatrix[13], invertedViewMatrix[14]);

Hi Yannick,



it seems I was wrong indeed. Thank you for the correction.



- Daniel

Login or Signup to post a comment