   Forward Vector for Object Movement
  Hi,I''m trying to move an object along a forward vector and I''m obviously missing something because it goes haywire.// inside FrameMove()static float fYaw   = 0.0f;static float fPitch = 0.0f;// adjust yaw and pitch with arrow keys// ''w'' moves forward// regenerate vectors// calculate yaw rotation matrix around arbitrary up axisD3DXMatrixRotationAxis( &m_matYaw, &m_vUp, fYaw );// transform forward and right vectors against yaw matrixD3DXVec3TransformCoord( &m_vForward, &m_vForward, &m_matYaw );D3DXVec3TransformCoord( &m_vRight, &m_vRight, &m_matYaw );// calculate pitch matrix around new right vectorD3DXMatrixRotationAxis( &m_matPitch, &m_vRight, fPitch );// again, transform vectors against matrixD3DXVec3TransformCoord( &m_vForward, &m_vForward, &m_matPitch );D3DXVec3TransformCoord( &m_vUp, &m_vUp, &m_matPitch );// if user hit ''w''    m_vPosition += m_vForward * m_fElapsedTime;// or backward, subtract and assign...// calculate translation matrixD3DXMatrixTranslation( &m_matTrans, m_vPosition.x, m_vPosition.y, m_vPosition.z );// concatenate matricesD3DXMATRIX matTransform;D3DXMatrixIdentity( &matTransform );D3DXMatrixMultiply( &matTransform, &matTransform, &m_matYaw );D3DXMatrixMultiply( &matTransform, &matTransform, &m_matPitch );D3DXMatrixMultiply( &matTransform, &matTransform, &m_matTrans );// set the transformm_pd3dDevice->SetTransform( D3DTS_WORLD, &matTransform );Thanks for taking the time to read it.Regards,break_r 
  Whoa, that's some pretty complicated move code.  Here's my move code that works really well, so read it and check for differences: static real dir_angle = 0.0f;vector3 Velocity = SceneMgr->GetDirection() / 2.0f;vector3 FinalVel = vector3( 0.0f, 0.0f, 0.0f );vector3 pos, dir;pos = SceneMgr->GetPosition();dir = SceneMgr->GetDirection();if( want_to_strafe_left ){vector3 Norm;   D3DXVec3Cross( &Norm, &vector3( 0.0f, 1.0f, 0.0f ), &Velocity );   Norm = -Norm;   FinalVel += Norm;}if( want_to_strafe_right ){vector3 Norm;   D3DXVec3Cross( &Norm, &vector3( 0.0f, 1.0f, 0.0f ), &Velocity );   FinalVel += Norm;}if( want_to_move_forward ){   FinalVel += Velocity;}if( want_to_move_back ){   FinalVel -= Velocity;}if( MState.X || MState.Y )  // MState contains relative mouse movements since last frame{matrix4x4 transform;SceneManager* SceneMgr = SceneManager::getPtr();real HorizAngle, VertAngle;HorizAngle = MState.X * (90.0f / 800.0f);VertAngle  = MState.Y * (90.0f / 600.0f);{   matrix4x4 A, B;   D3DXMatrixRotationY( &A, D3DXToRadian( -dir_angle ) );   D3DXMatrixRotationX( &B, D3DXToRadian(  VertAngle ) );   D3DXMatrixMultiply( &transform, &A, &B );   D3DXMatrixRotationY( &A, D3DXToRadian(  dir_angle + HorizAngle ) );   D3DXMatrixMultiply( &transform, &transform, &A );   dir_angle += HorizAngle;   D3DXVec3TransformCoord( &dir, &dir, &transform );}   // this line keeps the cursor in the middle of the screen   // rect is GetWindowRect(), client is GetClientRect()   SetCursorPos( rect.left + 3 + (client.right / 2), rect.top + 23 + (client.bottom / 2) );}// do collision checking against all primitives// pos + FinalVel is the new position; pos is the old position// dir also contains updated mouse look informationpos = pos + FinalVel;// 'pos' is final position, 'dir' is final direction (vector3)Hope this helps!  If the mouse look code is unclear, let me know and I'll explain it more.   Chris PergrossiMy Realm | "Good Morning, Dave" [edited by - c t o a n on February 9, 2004 1:52:26 AM];  Looks as if your code is always rotating about the x- and y-axes. I have similar code that works around those axes to orient the object and move it around. However, I''m looking for rotation about an arbitrary axis. ;  D3DXMatrixRotationAxis( D3DXMATRIX* pOut, D3DXVECTOR3* pAxis, float Angle) ;  Well, what the code does is rotate the object back into a basis aligned with the world basis, which allows you to use the basic X,Y axis rotation functions to transform the direction accordingly.   Chris PergrossiMy Realm | "Good Morning, Dave" 