Fix plane touching box backsideness.

Because a box has size, even when touching a plane, the side on which the
box is can be determined (unlike a point).
This commit is contained in:
Bill Currie 2011-11-28 17:12:39 +09:00
parent 869cd19260
commit 985667ecba
2 changed files with 9 additions and 3 deletions

View file

@ -353,6 +353,10 @@ test_t tests[] = {
{ -17, 0, 8}, {-1, 0, 72}, { 1, 0, 0, 1, 0, 9}},
{"Box, Covered Step", &box, &hull_covered_step,
{ -8, 0, 40}, {8, 0, 72}, { 1, 0, 0, 1, 0, 9}},
{"Box, Covered Step touch backside", &box, &hull_covered_step,
{ -8, 0, 8}, {-12, 0, 12}, { 1, 0, 0, 1, 0, 9}},
{"Point, Covered Step touch backside", &point, &hull_covered_step,
{ 0, 0, 8}, {-12, 0, 12}, { 1, 0, 1, 1, 0, 9}},
{"Box, Step 2", &box, &hull_step2,
{ 0, 0, 64}, {0, 0, 0}, { 0.375, 0, 0, 1, 0, 5}},

View file

@ -551,9 +551,11 @@ MOD_TraceLine (hull_t *hull, int num,
num = node->children[0];
continue;
}
//FIXME non-zero offset lets the object touch the plane but still be
//behind the plane
if (start_dist < -offset && end_dist < -offset) {
//non-zero offset lets the object touch the plane but still be
//behind the plane. however, point traces are assumed to be on the
//front side of the plane if touching the plane
if ((offset && start_dist <= -offset && end_dist <= -offset)
|| (!offset && start_dist < -offset && end_dist < -offset)) {
// entirely behind the plane
plane = 0;
leaf = hull->nodeleafs[num].leafs[1];