Original Post
Hi all , I am trying to make boundingbox collision for my 3D models instead using Sphere because is more accurate, but collision is always true here,how am I drawing the box:
Result:

and when I debug the bounding box , here what I see:
BoundingBox sbox;
private Vector3 min = new Vector3(float.MaxValue,float.MaxValue,float.MaxValue);
private Vector3 max = new Vector3(float.MinValue,float.MinValue,float.MinValue);
foreach (ModelMesh meshh in texture.Meshes)
{
foreach (ModelMeshPart meshPart in meshh.MeshParts)
{
int vertexStride = meshPart.VertexBuffer.VertexDeclaration.VertexStride;
int vertexBufferSize = meshPart.NumVertices * vertexStride;
float[] vertexData = new float[vertexBufferSize / sizeof(float)];
meshPart.VertexBuffer.GetData<float>(vertexData);
for (int i = 0; i < vertexBufferSize / sizeof(float); i += vertexStride / sizeof(float))
{
Vector3 transformedPosition = Vector3.Transform(new Vector3(vertexData, vertexData[i + 1], vertexData[i + 2]), enemymat);
min = Vector3.Min(min, transformedPosition);
max = Vector3.Max(max, transformedPosition);
}
}
sbox = new BoundingBox(min,max);
Result:

and when I debug the bounding box , here what I see:


