#### Archived

This topic is now archived and is closed to further replies.

# D3DXIntersect()

This topic is 5615 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

In the dx9 there is a new function called D3DXIntersect() that gives you the array of faces that been passed by a line. This function works when the world is identity and the mesh too but what if we have a matrix for the mesh MeshMat and we need it to be intersected with a line???? i have tried a code but didnt work,see this: void Intersect_Triangle(LPD3DXMESH mesh,D3DXMATRIX MeshMat,D3DXVECTOR3 Orig,D3DXVECTOR3 Dir,unsigned int *face); { D3DXMATRIX invmat; D3DXVECTOR3 neworig,newdir; D3DXMatrixInverse(&invmat,&MeshMat); // compute the new locations for the line neworig.x=invmat._11*Orig.x+invmat._12*Orig.y+invmat._13*Orig.z+mat._41; neworig.y=invmat._21*Orig.x+invmat._22*Orig.y+invmat._23*Orig.z+mat._42; neworig.z=invmat._31*Orig.x+invmat._32*Orig.y+invmat._33*Orig.z+mat._43; newdir.x=invmat._11*Dir.x+invmat._12*Dir.y+invmat._13*Dir.z+mat._41; newdir.y=invmat._21*Dir.x+invmat._22*Dir.y+invmat._23*Dir.z+mat._42; newdir.z=invmat._31*Dir.x+invmat._32*Dir.y+invmat._33*Dir.z+mat._43; // Then Call the function D3DXIntersect() D3DXIntersect(mesh,neworig,newdir,...........); } And it returns wholy diffrent face????????

1. 1
2. 2
Rutin
22
3. 3
4. 4
frob
16
5. 5

• 9
• 33
• 13
• 12
• 10
• ### Forum Statistics

• Total Topics
632577
• Total Posts
3007163

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!