title: OpenGL - how to construct an FPS style camera(the gun attached to it will move and rotate with it)
body: <p>my question is pretty directly: how to construct FPS camera, like in shooter games(you have gun, and whenever you rotate camera, gun rotates too.)</p>
  
  <p>Actually, moving is no problem, just(well, before i start coding, i want to say, i am using libGDX which is an opengl framework, but you would understand to all as i would understand to opengl code) :</p>
  
  <pre><code>gun.transform.setTranslation(camera.position);// sets gun to the center of the camera
  camera.rotate(0,1,0,-3); //rotates direction and up vector of the camera
  gun.transform.rotate(0,1,0,-3); // rotates the gun
  gum.transform.trn(0.18f, -0.12f, -0.24f); //offseting the gun, to be everytime in the right bottom corner of the screen
  </code></pre>
  
  <p>but this does not work. The camera is rotating kind of more than the gun. it looks like camera is sphere and.. it isnt what i want.</p>