   How do you move a mesh in the matrix??
  Oh the frustration :)Iv been seacheing throgh so many recoreces but none can tell me how to tell you mesh where it is at in the world matrix, i mean i understand it need a modal matrix but how do i tell the "X File" format what its matrix is? Is there a function i'm missing in the API that is like MeshData(&matrix) cause i found nothing help me out plz that you   
  You might want to take a look at this thread, the 5th reply. It contains some info on how matrices and meshes work in DirectX, that may help clear things up for you.   ;  Ill be a bit more spific i understand matrixs but i need to know how to set a given matix to a x file meshthe following was from the sample in dx sdk dalphenV app, my question is since all the matrix deffinitions are local how dose matDolphin know that it is the dolphin mesh??HRESULT CMyD3DApplication::FrameMove(){    // Animation attributes for the dolphin    FLOAT fKickFreq    = 2*m_fTime;    FLOAT fPhase  = m_fTime/3;    FLOAT fBlendWeight = sinf( fKickFreq );    // Move the dolphin in a circle    D3DXMATRIXA16 matDolphin, matTrans, matRotate1, matRotate2;    D3DXMatrixScaling( &matDolphin, 0.01f, 0.01f, 0.01f );    D3DXMatrixRotationZ( &matRotate1, -cosf(fKickFreq)/6 );    D3DXMatrixMultiply( &matDolphin, &matDolphin, &matRotate1 );    D3DXMatrixRotationY( &matRotate2, fPhase );    D3DXMatrixMultiply( &matDolphin, &matDolphin, &matRotate2 );    D3DXMatrixTranslation( &matTrans, -5*sinf(fPhase), sinf(fKickFreq)/2, 10-10*cosf(fPhase) );    D3DXMatrixMultiply( &matDolphin, &matDolphin, &matTrans );    // Animate the caustic textures    DWORD tex = ((DWORD)(m_fTime*32))%32;    m_pCurrentCausticTexture = m_pCausticTextures[tex];    // Set the vertex shader constants. Note: outside of the blend matrices,    // most of these values don't change, so don't need to really be set every    // frame. It's just done here for clarity    {   // Some basic constants   D3DXVECTOR4 vZero( 0.0f, 0.0f, 0.0f, 0.0f );   D3DXVECTOR4 vOne( 1.0f, 0.5f, 0.2f, 0.05f );   FLOAT fWeight1;   FLOAT fWeight2;   FLOAT fWeight3;   if( fBlendWeight > 0.0f )   {  fWeight1 = fabsf(fBlendWeight);  fWeight2 = 1.0f - fabsf(fBlendWeight);  fWeight3 = 0.0f;   }   else   {  fWeight1 = 0.0f;  fWeight2 = 1.0f - fabsf(fBlendWeight);  fWeight3 = fabsf(fBlendWeight);   }   D3DXVECTOR4 vWeight( fWeight1, fWeight2, fWeight3, 0.0f );   // Lighting vectors (in world space and in dolphin model space)   // and other constants   FLOAT fLight[]    = { 0.0f,  1.0f, 0.0f, 0.0f };   FLOAT fLightDolphinSpace[]    = { 0.0f,  1.0f, 0.0f, 0.0f };   FLOAT fDiffuse[]  = { 1.00f, 1.00f, 1.00f, 1.00f };   FLOAT fAmbient[]  = { 0.25f, 0.25f, 0.25f, 0.25f };   FLOAT fFog[] = { 0.5f, 50.0f, 1.0f/(50.0f-1.0f), 0.0f };   FLOAT fCaustics[] = { 0.05f, 0.05f, sinf(m_fTime)/8, cosf(m_fTime)/10 };   D3DXMATRIXA16 matDolphinInv;   D3DXMatrixInverse(&matDolphinInv, NULL, &matDolphin);   D3DXVec4Transform((D3DXVECTOR4*)fLightDolphinSpace, (D3DXVECTOR4*)fLight, &matDolphinInv);   D3DXVec4Normalize((D3DXVECTOR4*)fLightDolphinSpace, (D3DXVECTOR4*)fLightDolphinSpace);   // Vertex shader operations use transposed matrices   D3DXMATRIXA16 mat, matCamera, matTranspose, matCameraTranspose;   D3DXMATRIXA16 matViewTranspose, matProjTranspose;   D3DXMatrixMultiply(&matCamera, &matDolphin, &m_matView);   D3DXMatrixMultiply(&mat, &matCamera, &m_matProj);   D3DXMatrixTranspose(&matTranspose, &mat);   D3DXMatrixTranspose(&matCameraTranspose, &matCamera);   D3DXMatrixTranspose(&matViewTranspose, &m_matView);   D3DXMatrixTranspose(&matProjTranspose, &m_matProj);   // Set the vertex shader constants   m_pd3dDevice->SetVertexShaderConstantF(  0, (float*)&vZero,1 );   m_pd3dDevice->SetVertexShaderConstantF(  1, (float*)&vOne, 1 );   m_pd3dDevice->SetVertexShaderConstantF(  2, (float*)&vWeight,   1 );   m_pd3dDevice->SetVertexShaderConstantF(  4, (float*)&matTranspose, 4 );   m_pd3dDevice->SetVertexShaderConstantF(  8, (float*)&matCameraTranspose,  4 );   m_pd3dDevice->SetVertexShaderConstantF( 12, (float*)&matViewTranspose,  4 );   m_pd3dDevice->SetVertexShaderConstantF( 19, (float*)&fLightDolphinSpace,   1 );   m_pd3dDevice->SetVertexShaderConstantF( 20, (float*)&fLight,    1 );   m_pd3dDevice->SetVertexShaderConstantF( 21, (float*)&fDiffuse,  1 );   m_pd3dDevice->SetVertexShaderConstantF( 22, (float*)&fAmbient,  1 );   m_pd3dDevice->SetVertexShaderConstantF( 23, (float*)&fFog, 1 );   m_pd3dDevice->SetVertexShaderConstantF( 24, (float*)&fCaustics, 1 );   m_pd3dDevice->SetVertexShaderConstantF( 28, (float*)&matProjTranspose,  4 );    }    return S_OK;}Edit: Source tags, please.[Edited by - Muhammad Haggag on December 6, 2005 8:23:11 AM];  Do you mean setting matrices for skeletal animation?Edit: just saw your code snippet, but Endurion beat me to it :)   ;  It simply doesn't know. You can't associate a mesh with a matrix.In Direct3D, when you set a matrix ALL following renderings are affected by it until you set another matrix.   ;  but then when doing a movment how can i be sure im moving the mesh i want to and not moving the world?and that still dosn't explane how the matDolphin in the code above knows what it is accocated to   ;  The matrix is simply associated to "what I'm rendering now".You set a matrix, then you render your mesh, then you set another matrix.The matrix isn't associated to your mesh, it's just the one D3D has been told to use, and will keep using until you give it another one.   ;Quote:but then when doing a movment how can i be sure im moving the mesh i want to and not moving the world?Because you define the order when to set matrices and when to render meshes. The basic functionality with the fixed function pipeline runs like this:Set MatrixRender WorldSet MatrixRender MeshSet other MatrixRender other MeshQuote:and that still dosn't explane how the matDolphin in the code above knows what it is accocated toIt doesn't. In the example code matDolphin is applied to the vectors and used to calculate matCamera and mat. Those are set as vertex shader constants and i guess the shader applies the transforms in that case.   