Bounding Boxes question.

Started by
2 comments, last by Crypthor 20 years, 7 months ago
Hi. Well, if i''m using bounding boxes for collision testing: I can calculate distance between two points ( bounding box center and player position for example ). In case of Bounding Sphere: there just a radius, so this distance must be greater than radius. In case of BBox: i don''t know how to calculate bbox collision so please help, i''m sunking in math ! And BBox - is a cube or any dimensional box ? There is some formulas, can you tell me ? Thank You !
Cryp
Advertisement
Just do a loop and find the lowest X value and thats the left side, highest X value and thats the right side. Greatest Y Value, thats the top. Lowest Y Value thats the bottom. Lowest Z is the front. Greatest Z is the back. Sorry Im leaving for vacation right now so I dont have time to give you source, but Im sure you could easily right a loop through the vertices and do a simple if(). later,
maybe too late but if u r using DirectX try D3DXComputeBoundingBox
D3DXComputeBoundingBox will only compute an axis oriented bounding box, but will not check for bounding box to bounding box collision.

There are a couple of different kinds of bounding boxes and the boxes are boxes (not necessarily cubes). The two main kinds of bounding boxes are AABB (axis aligned bounding box) or OBB (oriented bounding box). The first one, AABB, has all six planes of the box aligned with the basis of the coordinate system. This is the simplest box and is that D3DXComputerBoundingBOx will create. OBB is much harder and will oriented the box to best fit the object. I am working on a tutorial for this for gamedev.

If you are using the AABB, you might as well stick to bounding spheres and just have a simple radius test (since you are "sunking in math").

Good luck,
/jk

Are you "down with OBB?"

[edited by - kershatwork on September 19, 2003 12:20:42 PM]

This topic is closed to new replies.

Advertisement