title: Arcball Camera: how to obtain right, direction and up
body: <p>I'm trying to implement a camera that follows a moving object. I've implemented these functions:</p>
  
  <pre><code>void Camera::espheric_yaw(float degrees, glm::vec3 center_point)
  {
  
      float lim_yaw = glm::radians(89.0f);
      float radians = glm::radians(degrees);
      absoluteYaw += radians;
  
      ... clamp absoluteYaw
  
      float radius = 10.0f;
      float camX = cos(absoluteYaw) * cos(absoluteRoll) * radius;
      float camY = sin(absoluteRoll)* radius;
      float camZ = sin(absoluteYaw) * cos(absoluteRoll) * radius;
      eyes.x = camX;
      eyes.y = camY;
      eyes.z = camZ;
      lookAt = center_point;
      view = glm::normalize(lookAt - eyes);
      up = glm::vec3(0, 1, 0);
      right = glm::normalize(glm::cross(view, up));
  
  }
  </code></pre>
  
  <p>I want to use this function (and the pitch version) for a camera that follows a moving 3d model. Right now, it works when the center_point is the (0,1,0). I think i'm getting the position right but the up vector is clearly not always (0,1,0).</p>
  
  <p>How can I get my up, view and right vector for the camera? And then, if I update the eyes position of the camera this way, how will my camera move when the other object (centered at center_position parameter) moves?</p>
  
  <p>The idea is to update this each time I have mouse input with centered_value = center of the moving object. Then use gluLookAt with view, eyes and up values of my camera (and lookAt which will be eyes+view).</p>