Bounding Box of a moving mesh

Started by
3 comments, last by Guimo 18 years, 10 months ago
When I use D3DXComputeBoundingBox,I get min and max corners of box,but the mesh is moving and I can not use those corners to find if the ray intersects with the bounding box of the mesh. When object moves,which process should I apply to corners? [Edited by - Coder on June 17, 2005 10:57:50 AM]
Advertisement
min += move, and max += move

Maybe I'm missing something though.
Make a temp vector for each of the min/max variables, then multiply those temp vectors by the object's world transformation matrix.
Quote:Original post by evanofsky
Make a temp vector for each of the min/max variables, then multiply those temp vectors by the object's world transformation matrix.

This isn't enough if you are using an arbitrary transformation matrix (with rotation, etc). You need to find the 8 corners of the AABB (ie. every permutation of the two 3-tuples), transform them by the world matrix, then reform a new AABB around the 8 transformed points. This will, of course, enlarge your box and it will no longer fit tightly, but otherwise you'd have to transform each of the contained vertices (yikes!) and recalculate the AABB. Oriented bounding boxes solve the latter problem (trasforming them maintains a tight fit), but are computationally more expensive.
Hi,
We have two methods to check collisions. First, we use a BB that easilly encloses our model. Second, we use a medium (2000 polys) model for rendering a a very low (300 polys) model for collision detection/shadows/reflections in order to save time. The low poly model uses the same matrices than the original model so it mimicks the positions of the original model. Usually we mix both techniques for the final result. That frees us about using aligned BB which are harder to maintain and the engine keeps simple.

May be that helps you.

Luck!
Guimo

This topic is closed to new replies.

Advertisement