slap some grease on those corners. This fixes the sticking on angled corners

bug. The DIST_EPSILON shifts have been removed from PM_RecursiveHullCheck and
only one DIST_EPSILON shift is done in PM_PlayerMove now. This might even give
a very slight speedup.
This commit is contained in:
Bill Currie 2001-02-11 03:49:20 +00:00
parent 08fc75fd32
commit 2be320d66f

View file

@ -232,13 +232,9 @@ PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
num = node->children[1]; num = node->children[1];
goto loc0; goto loc0;
} }
// put the crosspoint DIST_EPSILON pixels on the near side so that both
// p1 and mid are on the same side of the plane
side = (t1 < 0); side = (t1 < 0);
if (side) frac = bound (0, t1 / (t1 - t2), 1);
frac = bound (0, (t1 + DIST_EPSILON) / (t1 - t2), 1);
else
frac = bound (0, (t1 - DIST_EPSILON) / (t1 - t2), 1);
midf = p1f + (p2f - p1f) * frac; midf = p1f + (p2f - p1f) * frac;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
@ -368,7 +364,6 @@ PM_PlayerMove (vec3_t start, vec3_t end)
hull = PM_HullForBox (mins, maxs); hull = PM_HullForBox (mins, maxs);
} }
// PM_HullForEntity (ent, mins, maxs, offset);
VectorCopy (pe->origin, offset); VectorCopy (pe->origin, offset);
VectorSubtract (start, offset, start_l); VectorSubtract (start, offset, start_l);
@ -379,7 +374,6 @@ PM_PlayerMove (vec3_t start, vec3_t end)
trace.fraction = 1; trace.fraction = 1;
trace.allsolid = true; trace.allsolid = true;
// trace.startsolid = true;
VectorCopy (end, trace.endpos); VectorCopy (end, trace.endpos);
// trace a line through the apropriate clipping hull // trace a line through the apropriate clipping hull
@ -400,6 +394,17 @@ PM_PlayerMove (vec3_t start, vec3_t end)
} }
} }
/* if the fraction and endpos are not brought in a bit, the player cannot
slide along a wall */
if (total.fraction && total.fraction < 1.0) {
vec3_t v;
float l, f;
VectorSubtract (total.endpos, start, v);
l = VectorNormalize (v);
f = l - DIST_EPSILON;
VectorMA (start, f, v, total.endpos);
total.fraction *= f/l;
}
return total; return total;
} }