Jump to content
  • Advertisement

Archived

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

Issues with interection and LPD3DXBUFFER plz help

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

The issue comes up when I try to test intersect. Both of my errors come up in that. My intersect code is: float cNodeTreeMesh::GetHeightAbove(float XPos, float YPos, float ZPos) { BOOL Hit; float u, v, Dist; DWORD FaceIndex; D3DXIntersect(m_Mesh->m_Mesh, &D3DXVECTOR3(XPos,YPos,ZPos), &D3DXVECTOR3(0.0f, 1.0f, 0.0f), &Hit, &FaceIndex, &u, &v, &Dist, LPD3DXBUFFER &ppAllHits, DWORD &pCountOfHits); if(Hit == TRUE) return YPos+Dist; return YPos; } The errors I am getting is : C:\NodeTree.cpp(374) : error C2065: ''ppAllHits'' : undeclared identifier C:\NodeTree.cpp(374) : error C2275: ''LPD3DXBUFFER'' : illegal use of this type as an expression c:\dxsdk\include\d3dx8core.h(30) : see declaration of ''LPD3DXBUFFER'' C:\NodeTree.cpp(374) : error C2065: ''pCountOfHits'' : undeclared identifier C:\NodeTree.cpp(374) : error C2275: ''DWORD'' : illegal use of this type as an expression c:\program files\microsoft visual studio\vc98\include\windef.h(141) : see declaration of ''DWORD'' Any ideas i mean its almost an exact copy of what the SDK says for intersect. Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
Look at what the errors are telling you. They''re saying that you have a couple of "undeclared identifier"s. That means that you''re trying to use a variable that you never declared anywhere.

That''s the problem when you cut and paste code from the SDK without really looking at it. It seems that you literally cut and pasted the code from the functions reference page. Change your code to this:

float cNodeTreeMesh::GetHeightAbove(float XPos, float YPos, float ZPos)
{
BOOL bHit = FALSE;
float u, v, Dist;
DWORD dwFaceIndex, dwCountOfHits;
LPD3DXBUFFER pAllHits = NULL;

D3DXIntersect(m_Mesh->m_Mesh, &D3DXVECTOR3(XPos,YPos,ZPos), &D3DXVECTOR3(0.0f, 1.0f, 0.0f), &bHit, &dwFaceIndex, &u, &v, &Dist, &pAllHits, &dwCountOfHits);

if(bHit == TRUE)
return YPos+Dist;

return YPos;
}

In your case, I doubt that you''re interested in the list of all the faces your ray has hit. If that''s true, then you can just set the last two parameters of the intersect function to NULL and it should work just fine.

neneboricua

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!