1
109 Jan 07, 2014 at 00:45

For my airplane game, my drones are shooting some magical boxed towards the enemy planes. The boxes rotates in all directions as they approach an airplane. Once it hit an airplane, it should resize itself so the airplane fit inside the box and is them trapped. The problem is, the box is not axis aligned. Is there an algo somewhere that allow to fit a set of triangles in it and the box grows as you add triangles in it? like AABB does?

#### 4 Replies

1
165 Jan 07, 2014 at 02:35

Do you want to grow the box while maintaining a fixed orientation? If so, you can just transform the plane vertices into the box’s coordinate system. The box is axis-aligned in its own coordinate system so you can treat it like an AABB and just take min/max of everything.

0
109 Jan 07, 2014 at 03:05

Yes, I want to grow it in whatever orientation it is. I’m not sure what you mean tho. An AABB doesn’t have 8 points to define its bounding box (like a frustum do), an AABB only has a (float3) min and max. So I’m lost here Reed!!!

1
165 Jan 07, 2014 at 04:26

They’re still boxes, right? Set up a coordinate system that’s aligned with the box, in whatever orientation it’s in. Then the box is axis-aligned in that coordinate system, by definition. If you transform the vertices into that coordinate system, you can calculate the min and max. Then generate the 8 corners from the min and max, and transform them back into world coordinates.

0
109 Jan 07, 2014 at 05:41

oh I see, I get it. Thanks again Reed for your help.