Non-AABB question

88dc730f0f71e55be39de0ad103bd9ff
1
Alienizer 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

Please log in or register to post a reply.

A8433b04cb41dd57113740b779f61acb
1
Reedbeta 167 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.

88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 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!!!

A8433b04cb41dd57113740b779f61acb
1
Reedbeta 167 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.

88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 109 Jan 07, 2014 at 05:41

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