0

I'm working on a 3D MonoGame project that involves in drawing models and checking collision of models. My idea is to put a BoundingBox around each loaded model and using BoundingBox.Intersects() to do collision detection. However, I'm not that familiar with BoundingBox and I'm not sure how to put BoundingBox around loaded models. Any detailed instructions on this aspect? Or probably some other ways to do collision detection?

Luyao Tian
  • 45
  • 1
  • 5

1 Answers1

0

Using the bounding box you would need to create it using the mesh dimensions.

You would have to find the minimum and maximum points on the mesh and pass those in as your parameters to the bounding box constructor. These would be:

Vector3(halfWidth, halfLength, halfHeight) ///or whatever order you need it as
Vector3(-halfWidth, -halfLength, -halfHeight).

You will also need to add the current position when you generate the bounding box.

http://www.monogame.net/documentation/?page=T_Microsoft_Xna_Framework_BoundingBox