pspballer07


How do you find out how long, wide, and deep a model is Like width would be the farthest right vertice subract the farthest left vertice. I need to know for collision

Re: Getting the Model width and height

Bernhard Wolkerstorfer


You can get a BoundingSphere object for all the meshes in a model. After that you can convert them into BoundingBox objects. These two classes have a method for intersection calculation.




Re: Getting the Model width and height

grifft

The BoundingSphere class already mentioned will give you a basic idea of the overall size of a Mesh (or the entire Model if you Merge the BoundingSpheres for each Mesh). The left most point is BoundingSphere.Center.X - BoundingSphere.Radius, right most BoundingSphere.Center.X + BoundingSphere.Radius, etc. This is just an approximation: the spheres don't work well on non-spherical objects.

There is a tutorial on www.riemers.net (in the forums, I believe) about creating a new Model class that will allow you to read the Model indices directly. Or, you could wait until the April/May XNA update which will provide updated access to the Mesh.

Just some ideas... hope they help.







Re: Getting the Model width and height

grifft

As an update to this post, the XNA 1.0 refresh was released today. I guess I answered a day early.

http://msdn2.microsoft.com/en-us/xna/aa937795.aspx






Re: Getting the Model width and height

pspballer07


lol





Re: Getting the Model width and height

pspballer07

How do I put this together with a model