Vuforia inverse model matrix gives wrong effects. How to fix?
May 8, 2015 - 5:43am #1
I'm using Vuforia on Android for AR development. We can obtain the `modelViewMatrix` using
Matrix44F modelViewMatrix_Vuforia = Tool.convertPose2GLMatrix(trackableResult.getPose());
This works great. Any geometry multiplied by this matrix and then by the projection matrix shows up on the screen as expected, with (0,0,0) at the centre of the tracked target.
But what I also want to do is to simultaneously draw geometry relative to the user's device, so to achieve this we can work out the inverse modelViewMatrix using:
Matrix44F invTranspMV = SampleMath.Matrix44FTranspose(modelViewMatrix_Vuforia);
Matrix44F inverseMV = SampleMath.Matrix44FInverse(invTranspMV);
modelViewMatrixInverse = invTranspMV.getData();
This works pretty well, e.g. if I draw a cube using this matrix, then when I tilt my phone up and down, the cube is also tilted up and down correctly, but when I turn left and right there's a problem. Left turning causes the cube to turn the wrong way as if I'm looking to the right hand side of it. Similarly with right turning.
Any ideas what might be wrong and how I might solve this?
I did https://developer.vuforia.com/forum/general-discussion/how-get-camera-positionorientation-pose-matrix (see top two posts) which describes a similar problem, but the answer isn't much help to me.
Any help much appreciated.
Are you sure you want to delete this message?
Are you sure you want to delete this conversation?