title: Whats wrong with my Matrix Rotation?
body: <p>I'm trying to rotate a model by</p>
  
  <pre><code>(float) Math.atan2(-camX.getXf() * padX, -camDir.getZf() * padY)
  </code></pre>
  
  <p>Y</p>
  
  <p>and</p>
  
  <pre><code>-MathUtils.HALF_PI
  </code></pre>
  
  <p>Z</p>
  
  <p>But</p>
  
  <pre><code>model.setRotation(new Matrix3(1,0,0,
                                0,(float) Math.atan2(-camX.getXf() * padX, -camDir.getZf() * padY),0,
                                0,0,-MathUtils.HALF_PI));
  </code></pre>
  
  <p>It rotates on the y axis (Though it's sideways because it's a md2 model) but rotating the Z axis doesn't make it right side up. Any idea why?</p>
  
  <p>Each variable is in it's respective area of the matrix.</p>
  
  <p>EDIT: alright, now I'm using this code:</p>
  
  <pre><code>float x = 0;
              float y = (float) Math.atan2(-camX.getXf() * padX, -camDir.getZf() * padY);
              float z = (float) -MathUtils.HALF_PI;
  
              float a = (float) Math.sin(x);
              float A = (float) Math.cos(x);
              float b = (float) Math.sin(y);
              float B = (float) Math.cos(y);
              float c = (float) Math.sin(z);
              float C = (float) Math.cos(z);
  
              Matrix3 m = new Matrix3(A*b, -(B*a),b,
                                     (C*a)+(A*b*c), (A*C)-(a*b*c), -(B*c),
                                     (a*c)-(A*C*b), (A*c)+(C*a*b), B*C); 
  </code></pre>
  
  <p>But now none of the axis are rotating correctly.</p>
  
  <p>This is how the matrix is set up:</p>
  
  <pre><code>xx, xy, xz, 
  yx, yy, yz, 
  zx, zy, zz
  </code></pre>