leopardGeckos
leopardGeckos

Reputation: 91

Collision detection between two axis aligned boxes only on one side of a plane

I need to check a collision between two axis aligned boxes. One of these boxes has been "sliced" by a plane, and it should only collide on one side of this plane. How can I detect if the collision between these two boxes takes place in this area? The plane can have an arbitrary rotation and position. The part of the box that will be discarded when cut by the plane will always be on the same side of the plane.

Upvotes: 0

Views: 139

Answers (1)

j_random_hacker
j_random_hacker

Reputation: 51316

  1. Intersect the boxes, producing either a box or nothing.
  2. If the intersection is nonempty, plug each of its 4 (or 8, if 3D) points into the plane equation; if and only if any of them are positive, there's a collision on the positive "side" of the plane. (If any part of the intersection is on this side of the plane, then at least one corner of the box must be, since boxes are convex.)

Upvotes: 1

Related Questions