Jump to content
  • Advertisement
Sign in to follow this  
FireSoul

How to create a bounding box?

This topic is 4884 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I need some help in how to create a bounding box for any object. I was hoping for a function that could be run before the game starts, and could generate a bounding box for any object. One method i could see, is to go through all of the objects vertices and find the max and min points in the x,y and z planes. From these max and mins i could create a cuboid around the object. Is there a better way? or is the above method fine?. If the above method is fine, could someone please show me how it could be done. Any help is appreciated.

Share this post


Link to post
Share on other sites
Advertisement
hi,

I don't usually say that, but read the manual (DirectX help) : D3DXComputeBoundingBox(...) takes a pointer to an ID3DXMesh interface and builds an axis aligned bouding box.
And if you're not using DirectX meshes, then the method you mentioned is good. Just lock your vertex buffer, parse all the vertices to find the max / min values along each axis.

Share this post


Link to post
Share on other sites
The DirectX help file which is given with the sdk. (directx_something.chm)
or just entering D3DXComputeBoundingBox in google, you'll find the description of the function on the MSDN website

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!