title: DirectX Matrix: transform relative to facing direction(like in an FPS)
body: <p>I took someone's advice but it did not work as I intended:</p>
  
  <pre><code>    M=inverse(inverse(M)*rotation_matrix);
  </code></pre>
  
  <p>This is the code for my update:</p>
  
  <pre><code>void TestApp::Update(float dt) {
      DirectX::SimpleMath::Matrix rotation =
      Matrix::CreateFromYawPitchRoll(rot.y, rot.x, 0.0f); //Rotation Matrix
      DirectX::SimpleMath::Matrix position = 
      Matrix::CreateTranslation(pos); //Postion Matrix
  
      m_view = 
      DirectX::XMMatrixInverse(nullptr, DirectX::XMMatrixMultiply( 
      DirectX::XMMatrixInverse(nullptr, position), rotation)); //This uses the advice
  //m_view is the Camera/View Matrix
  
  for (int i = 0; i &lt; 256; ++i) {
      if (GetAsyncKeyState(i)) {
          if (i == 87) { // W
              pos.z += dt * playerSpeed; //Move Forward
  
              continue;
  
          }
          else if (i == 68) { //D
              pos.x -= dt * playerSpeed; //Move Right
              continue;
  
          }
          else if(i == 83){//S
              pos.z -= dt * playerSpeed; //Move Backwards
              continue;
  
          }
          else if (i == 65) { // A
              pos.x += dt * playerSpeed; //Move Left
              continue;
  
          }
  
          else if (i == VK_NUMPAD8) {
              rot.x -= dt; 
              continue;
          }
          else if (i == VK_NUMPAD4) {
              rot.y += dt;
          }
          else if (i == VK_NUMPAD5) {
              rot.x += dt;
              continue;
          }
          else if (i == VK_NUMPAD6) {
              rot.y -= dt;
          }
      }
  }
  </code></pre>
  
  <p>The movement works perfectly fine but the rotation is iffy. It rotates around the world origin not like an FPS camera. Any help?</p>
  
  <p>I am using DirectX 11 with DirectX Tool Kit. The model rendered fine, movement forward, backwards, left, right works like an FPS camera but it is rotation the around the world origin(0, 0).</p>