Like I said
I got my bounding spheres computed but now I
seem to be having trouble getting to compute the collision
detection. As mentioned I''m retrieveing the bounding sphere
center and radius via an intermediate class which mreates my
mesh, but somehwere along the way I lose my values?? I mean
they get calculated fine but on retrieval they reach the
calling class as zeros?? I think I must have messed up my
pointers or so here is the code for retruning the values of
the sphere center and float of my actual mesh class:
Mesh:: ReturnBoundingSphere(D3DXVECTOR3* m_pCenter, float* m_pRadius){ m_pCenter = &pCenter m_pRadius = &pRadius}; //No problems here
here is the code of my intermediate class that gets the
values from the mesh and passes to the calling function
MeshBuilder::GetMeshBoundingSphere(D3DXVECTOR3* pCenter, float* pRadius){ Mesh1->ReturnBoundingSphere(pCenter, pRadius);};//Here the values returned are ZERO !!!
And here is my calling function i.e the detect collision
function, it calls to retrieve the values, and checks for
intersection. The problem is that the values returned are
zero so thats why I gues the program crashes.
DetectCollision(){ MeshBuilder1->GetMeshBoundingSphere(pCenter1, pRadius1); MeshBuilder2->GetMeshBoundingSphere(pCenter2, pRadius2); float fdistance = D3DXVec3Length(pBotCenter); D3DXVECTOR3 vTemp; HRESULT hr; D3DXVec3Subtract(&vTemp, pCenter2, pCenter1); {// WriteLog("D3DXVec3Subtract()",hr); //return false; } float distance = D3DXVec3Length(&vTemp); if(distance<= *pRadius1+*pRadius2) return true; else return false;};
What could be the problem cos I know that at the Mesh calss
the radii and centers are being computed just fine. Upon
retrieval something is going wrong
ANy help would be greatly appreciated guys