   boundingBox Question
  there are any ways that I can create bounding box without using, d3dxcomputeBoundingbox??I can find the min and max of vertex when I initialised the mesh.but when I move my mesh, the positions of vertex not update.I have no idea how to do.I guess that format should be like this but I don't know ?? isvertex position?? what I should call that variable?also, if you know the good tutorial/sample for d3dxcomputeBoundingboxplease tell me but not from toymaker. thanksD3DXVECTOR3 CMesh::GetMin(){D3DXVECTOR3 min;min.x = ??[0].x;min.y = ??[0].y;min.z = ??[0].z;for(int i=1; i<  m_pD3DMesh->GetNumVertices();i++){if(??.x <min.x)min.x = ??.x;if(??.y <min.y)min.y = ??.y;if(??.z <min.z)min.z = ??.z;}m_min.x = min.x;m_min.y = min.y;m_min.z = min.z;return m_min;}[Edited by - fantasyme on June 1, 2010 5:44:32 AM]
  Did you incorrectly copy the code for your GetMax function? If you're looking for the minimum values, you should be testing:if( vert.x < min.x ) min.x = vert.x;Also, when you move the mesh, do you move the bounding box the same amount?;Quote:Original post by BuckeyeDid you incorrectly copy the code for your GetMax function? If you're looking for the minimum values, you should be testing:if( vert.x < min.x ) min.x = vert.x;Also, when you move the mesh, do you move the bounding box the same amount?yes, I made mistake .....it GetMax codeanyway I fixed itI still got stupid value in my min and max like -15466+eandI am not sure what I think is possible or notfirst, I get min and max then I check collide withbool CFunction::collide(D3DXVECTOR3 Amin, D3DXVECTOR3 Bmin, D3DXVECTOR3 Amax, D3DXVECTOR3 Bmax){if(Amin.z < Bmax.z && Amax.z > Bmin.z && Amin.x < Bmax.x && Amax.x > Bmin.x && Amin.y < Bmax.y && Amax.y > Bmin.y){return true;}else{return false;}};Quote:I still got stupid value in my min and max like -15466+eYou obviously need to fix that before you do any more troubleshooting. Looks like one or more of the values in the mesh vertex buffer are bad. Check that.Your collision function will detect some, but not all, collisions between axis-aligned bounding boxes.It won't correctly detect this collision:    *---*    |   |  *-|---|-*  | |   | |  *-|---|-*    |   |    *---*;Quote:Original post by BuckeyeQuote:I still got stupid value in my min and max like -15466+eYou obviously need to fix that before you do any more troubleshooting. Looks like one or more of the values in the mesh vertex buffer are bad. Check that.Your collision function will detect some, but not all, collisions between axis-aligned bounding boxes.It won't correctly detect this collision:    *---*    |   |  *-|---|-*  | |   | |  *-|---|-*    |   |    *---*yes, you right.it detected perfect between cube and cube only.when I try to use for another models, it is not all right.Dear Buckeye, what should I do?could you please help? andyour picture makes me confuse?? what   ;  There are several methods to detect collision between bounding boxes. You can google for something like "bounding box collision detection" to see the various methods and algorithms. If you want to write your own routines, pick one of the methods and implement it.Another option is to try out one of the several collision detection/physics engines like ODE, Bullet, etc.   ;Quote:Original post by BuckeyeThere are several methods to detect collision between bounding boxes. You can google for something like "bounding box collision detection" to see the various methods and algorithms. If you want to write your own routines, pick one of the methods and implement it.Another option is to try out one of the several collision detection/physics engines like ODE, Bullet, etc.I see thanksbut i won't use engine coz i won't understand anythingand thanks for advice   