title: Is there any way to extract a transform matrix from a view matrix in glm?
body: <p>I need to extract the transform matrix from my camera to assign it to a mesh.</p>
  
  <p>I'm working in a computational graphics project in school, the objective is to simulate the arms of a character in first person perspective.</p>
  
  <p>My camera implementation includes a vector3 for the camera position, so i can assign that to my mesh, the problem is that i can't extract the rotation of the camera from my view matrix yet.</p>
  
  <p>I calculate my final pitch and yaw in the rotation function this way, x and y are the current mouse position in the screen</p>
  
  <pre><code>m_yaw += (x - m_mouseLastPosition.x) * m_rotateSpeed;
  
  m_pitch -= (y - m_mouseLastPosition.y) * m_rotateSpeed;
  </code></pre>
  
  <p>This is how i update the view matrix when it changes</p>
  
  <pre><code>glm::vec3 newFront;
  
  newFront.x = -cos(glm::radians(m_yaw)) * cos(glm::radians(m_pitch));
  
  newFront.y = sin(glm::radians(m_yaw)) * cos(glm::radians(m_pitch));
  
  newFront.z = sin(glm::radians(m_pitch));
  
  m_front = glm::normalize(newFront);
  
  m_right = glm::normalize(glm::cross(m_front, m_worldUp));
  
  m_up = glm::normalize(glm::cross(m_right, m_front));
  
  m_viewMatrix = glm::lookAt(m_position, (m_position + m_front), m_up);
  </code></pre>
  
  <p>Right now I can assign the position of the camera to my mesh, like this</p>
  
  <pre><code>m_mesh.m_transform = glm::translate(glm::mat4(1.0f), m_camera.m_position);
  </code></pre>
  
  <p>I can assign the camera position successfully, but not rotation.</p>
  
  <p>What i expect is to assign the full camera <strong>transform</strong> to my mesh, or to extract the <strong>rotation</strong> independently and assign it to the mesh after.</p>