Hi,

Last week I implemented jPCT-AE within my AR application instead of using my own OpenGL renderer; and first-off let me say that it is excellent, providing many more features than I could possibly code myself!

Like many others, I have some issues with rotations, but I did previously have this working (along with GPS location updates) very well. Due to the the various coordinate systems in play, I am generating vectors to describe the direction the camera should be facing in ECEF coordinates. These vectors were fed to the renderer as below;

`private float[] mLookMatrix = new float[16];`

public void setCameraPosition(CamPosition newCamera) {

Matrix.setLookAtM(mLookMatrix, 0,

newCamera.eyeX,

newCamera.eyeY,

newCamera.eyeZ,

newCamera.frontX + newCamera.eyeX,

newCamera.frontY + newCamera.eyeY,

newCamera.frontZ + newCamera.eyeZ,

newCamera.upX,

newCamera.upY,

newCamera.upZ);

}

with the following function being called on each DrawFrame();

`private void setViewAndProjection() {`

float[] modelMatrix = new float[16]; // model matrix (identity)

Matrix.setIdentityM(modelMatrix, 0);

Matrix.translateM(modelMatrix, 0, 0, 0, 0);

// calculating the current model-view-projection matrix

Matrix.frustumM(mProjMatrix, 0,

-fSize, fSize,

-fSize / ratio, fSize / ratio,

zNear, viewRange);

// multiply matrices

Matrix.multiplyMM(mWorldMatrix, 0, mProjMatrix, 0, mLookMatrix, 0);

Matrix.multiplyMM(modelViewProjectionMatrix, 0, mWorldMatrix, 0, modelMatrix, 0);

GLES20.glUniformMatrix4fv(muMVPMatrixHandle, 1, false, modelViewProjectionMatrix, 0);

}

Obviously a lot of this is no longer needed, but my issue is finding a suitable replacement for the Matrix.setLookAt() function within jPCT-AE.

The issue I have is that using

` public void setCameraPosition(CamPosition newCamera) {`

SimpleVector dir = new SimpleVector(

newCamera.frontX + newCamera.eyeX,

newCamera.frontY + newCamera.eyeY,

newCamera.frontZ + newCamera.eyeZ

);

SimpleVector up = new SimpleVector(

newCamera.upX,

newCamera.upY,

newCamera.upZ);

worldCamera.setOrientation(dir, up);

worldCamera.setPosition(newCamera.eyeX, newCamera.eyeY, newCamera.eyeZ);

}

...results in some very strange results! Initially 'the world' is viewed as before, but after a randomly short period of time, during movement of the device the axis of rotation get screwed up (x,y or z are inverted or switched) or just point in another direction to the one I am facing.

I have tried getting and setting the camera matrix directly, but with no benefit. Additionally I have searched the forum, but the various code snippets didn't help either, due to angles not being used.

Could anyone suggest either what is wrong, or how I can set the lookAt vectors in jPCT-AE as is done in OpenGL ??

Many thanks in advance.