   [DX9] D3DXIntersectSubset collision test
  Hi GameDevs !I have a scene with plenty of static meshes that each have a special subset that represent their collision volume. What I would like to do is use D3DXIntersectSubset to check if a ray representing the player in motion is intersecting said subset.D3DXVECTOR3 vPos = m_position; // World position of the playerD3DXVECTOR3 vDir = m_velocity; // Worldly movement direction, length depending on speedD3DXMATRIX invMat;D3DXMatrixInverse( &invMat, NULL, pDoodad->GetTransform() );D3DXVec3TransformCoord( &vPos, &vPos, &invMat );D3DXVec3TransformNormal( &vDir, &vDir, &invMat );BOOL bHit = FALSE;DWORD faceIndex = 0;float u = 0, v = 0, distance = 0;D3DXIntersectSubset( pDoodad->GetMesh(), collisionSubsetID, &vPos, &vDir, &bHit, &faceIndex, &u, &v, &distance, NULL, NULL );Given that this is done within a method of the player class, is this a proper implementation? I am certain that m_position and m_velocity of the player and the "Doodad"-transformation is correct and the mesh reads just fine. Still I can't get that little bool to turn true. Am I right to convert the player movement ray into the model space of the mesh? Have I interpreted the ray correctly? I'm really not sure, many thanks for any help.   
  The formula was right, however D3DXIntersectSubset() required the mesh to have been optimized with the D3DXMESHOPT_ATTRSORT flag or else it returned D3DERR_INVALIDCALL. Just for future reference.   ;  Hi,Vanderry, moving position and direction vectors of collision ray to local space of the mesh that you want to test collision is the "only" and best way. But, I think that something in moving "direction" vector is missing: Normalization of "new" direction vector. Here://Your code starts here and I know it works fine...//But...//After D3DXTransformNormal() thing....D3DXVec3Normalize (&vDir, &vDir);//others're same...Don't hasitate to try :)Regards.   