title: car orientation on a plane
body: <p>I am currently working on a simple car simulation on a plane in DirectX. I am having problems on orienting the car on the plane .
  <br/>what i am doing is this...</p>
  
  <pre><code>D3DXMATRIX planeMat //matrix of the plane on which car is currently situated.
  ...
  
  //calculating car rotation matrix (on XZ plane )
  D3DXMATRIX carRot;
  D3DXMatrixRotationY( &amp;carRot , yaw );
  
  //car up will same as plane
  D3DXVECTOR3 carUp = D3DXVECTOR3( planeMat._12 , planeMat._22 , planeMat._32 );
  //car lookat vector
  D3DXVECTOR3 carLookat = D3DXVECTOR3( carRot._13 , carRot._23 , carRot._33 );
  // calculating right vector
  D3DXVec3Cross( &amp;carRight , &amp;carLookAt , &amp;carUp );
  D3DXVec3Normalize( &amp;carRight , &amp;carRight );
  //calculating new lookat 
  D3DXVec3Cross( &amp;carLookAt , &amp;carRight , &amp;carUp );
  D3DXVec3Normalize( &amp;carLookAt , &amp;carLookAt );
  
  //car matrix
  D3DXMATRIX carMat; D3DXMatrixIdentity( &amp;carMat );
  carMat._11 = carRight.x ;carMat._21 = carRight.y ;carMat._31 = carRight.z ;
  carMat._12 = carUp.x ;carMat._22 =  carUp.y ;carMat._32 = carUp.z ;
  carMat._13 = carLookAt.x ;carMat._23 = carLookAt.y ;carMat._33 = carLookAt.z ;
  carMat._41 = carPos.x ;carMat._42 = carPos.y ;carMat._43 = carPos.z ;
  </code></pre>
  
  <p>I can't get car's rotation correct.<br/>please help me.</p>