0
\$\begingroup\$

I am having issues with the camera, I cant find how to invert the AXIS

Now

  • A point is 0,0,0
  • B point is 1,0,0
  • C point is 0,0,1

What I want is

  • A point 0,0,0
  • B point 0,0,1
  • C point 1,0,0

enter image description here

I cant find the way to do this, so if you can explain also why is this happening it will be great! (if you need more code ask for it)

Code:

final float eyeX = 2.0f;
    final float eyeY = 10f;
    final float eyeZ = 6.0f;

    final float lookX = 1.0f;
    final float lookY = 0.0f;
    final float lookZ = 6.0f;


    final float upX = 1.0f;
    final float upY = 0.0f;
    final float upZ = 0.0f;

    Matrix.setLookAtM(mViewMatrix, 0, eyeX, eyeY, eyeZ, lookX, lookY, lookZ, upX, upY, upZ);    

ViewPort

    GLES20.glViewport(0, 0, width, height);

    final float ratio = (float) width / height;
    final float left = -ratio;
    final float right = ratio;
    final float bottom = -1.0f;
    final float top = 1.0f;
    final float near = 1.0f;
    final float far = 25.0f;
    Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

I think you want eyeY = -10, upX = 0, and upZ = 1. The other values can stay.

Your given and desired points suggest you want to rotate the camera position and its up vector about an axis parallel to (1, 0, 1) by angle PI. Doing that would yield the values I listed above.

Can you explain why this is happening?

It looks like you are getting exactly what you specified. If you want a different result, change the values.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .