   Bounding Boxes
  Okay so im using the following tutorial:http://www.toymaker.info/Games/html/collisions.htmlIm at the part of the Axis Aligned Bounding Box. It has void CalcAABBFromOBB(const D3DXVECTOR3 *obb,D3DXVECTOR3 *minB,D3DXVECTOR3 *maxB)But later obb is used as an array i.e. obb[0], etc.I dont know all the ins and outs of C++ so im just checking if this is a typo?More importnatly, Im just looking for confirmation that that method CalcAABBFromOBB needs to be called every frame? Im nearly certain it does but yeah, confirmation would be nice.   
  You will only need to recalculate the AABB if the OBB has changed - that is, the OBB has been rotated or moved or scaled.An OBB - oriented bounding box - is not aligned to the axis, so you will need to know it's vertices. Just a min and max vector aren't enough, hence the vector array. What this function does is just checking the minimum and maximum values in the OBB's vertices, and storing them in the min and max vector respectively. That gives you the AABB.Note that that function can give you the AABB of any number of vertices - it's just limited to 8 vertices because 3D OBB's consist of 8 vertices.   ;Quote:Original post by discodowneyvoid CalcAABBFromOBB(const D3DXVECTOR3 *obb,D3DXVECTOR3 *minB,D3DXVECTOR3 *maxB)But later obb is used as an array i.e. obb[0], etc.The parameter to obb is probably declared asD3DXVECTOR3 obbOfMyObject[8];so it can store 8 instances of D3DXVECTOR3. When you want to give this as parameter obb when invoking CalcAABBFromOBB, then you can (a) theoretically make a copy of all 8 vectors, resulting in a total of 8 * 3 floats (I think), so it would be somewhat costly. Or you can (b) use a pointer to the first vector (and the implicit knowledge that there are 7 other vectors just behind those from which you have the address). Doing so is typical for C, and hence has been carried into C++, too. An access is then done either asobb->xbut only for the first vector. To access the i-th vector you have to do some pointer arithmetic, like(obb+i)->x Now, that is just another kind of writingobb.xUsing something likestruct OBB {    D3DXVECTOR3 corners[8];};void CalcAABBFromOBB(const OBB *obb, D3DXVECTOR3 *minB,D3DXVECTOR3 *maxB);OBB obbOfMyObject;CalcAABBFromOBB( &obbOfMyObject, ...);would be a bit better, but still doesn't protect you from accessing out-of-index, e.g. corners[8]. You have to use methods if you want to be safe, e.g. a class from the STL library.Quote:Original post by discodowneyMore importnatly, Im just looking for confirmation that that method CalcAABBFromOBB needs to be called every frame? Im nearly certain it does but yeah, confirmation would be nice.It needs to be called whenever the OBB has changed and its belonging AABB is needed. This may be every frame, but need not to be. E.g. if the object inside the OBB is animated, then it is probable that the OBB hs changed. If e.g. only the camera is moved, then a recalculation of the AABB (which is fixed to the world, not to the camera) need not be re-computed. ((EDIT: As Captain P already stated.))   ;  Good Stuff. Cheers lads.   ;  Just FYI, you can compute the AABB for an OBB given only the OBB's basic representation (center, orientation, and extents); you don't actually need the 8 corners for this. The 'direct' method is more efficient than the '8 corners' method (which might matter if you're doing this many times per update), and will *definitely* be more efficient if the only reason you're computing the corners is to rebuild the AABB.   