Jump to content
Posted 11 June 2011 - 07:26 PM
Posted 12 June 2011 - 12:46 PM
Posted 12 June 2011 - 01:31 PM
After transforming the vertices with the world transform of the second mesh you also need to transform them with the inverted world transform of the first mesh to get them in lcoal space for the first mesh. If you don't know how to invert a matrix look at D3DXMatrixInvert.
To speed up the process you could multiply the two matrices with each other after you invert the matrix. That way you only need to transform with one matrix (the result of the multiply) when transforming the vertices.
Posted 12 June 2011 - 01:45 PM
Posted 12 June 2011 - 02:02 PM
Keep in mind that the order of multiplication matters when multiplying the two matrices. I think it should be mesh1 X mesh2 but it might be the other way around, make sure you try both. Also try it without multiplying the matrices, do the transforms one after the other just to make sure you get the same results.
It would be useful if you could post some code to better see exactly what you are doing.