Yes this is how “axis-aligned bounding boxes” work. Box3
should actually be renamed to AABB3
and Box2
to AABB2
. I’m not going to explain AABB
since existing literature extensively discussed this topic. Just give google a try.
Anyway, you need a completely different type of bounding volume that allows rotation (e.g. an oriented bounding box or OBB). However, proper implementations are complex and often require the computation of a convex hull first.