vec4_t endplane;
vec4_t newimpactplane;
texture_t *hittexture = NULL;
- vec_t startdepth = trace->startdepth;
+ vec_t startdepth = 1;
vec3_t startdepthnormal;
- VectorCopy(trace->startdepthnormal, startdepthnormal);
+ VectorClear(startdepthnormal);
Vector4Clear(newimpactplane);
// Separating Axis Theorem:
//Con_Printf("%c%i: startdist = %f, enddist = %f, startdist / (startdist - enddist) = %f\n", nplane2 != nplane ? 'b' : 'a', nplane2, startdist, enddist, startdist / (startdist - enddist));
// aside from collisions, this is also used for error correction
- if (startdist < 0 && trace->startdepth < startdist)
+ if (startdist < 0 && (startdepth < startdist || startdepth == 1))
{
- trace->startdepth = startdist;
- VectorCopy(startplane, trace->startdepthnormal);
+ startdepth = startdist;
+ VectorCopy(startplane, startdepthnormal);
}
if (startdist > enddist)
trace->allsolid = true;
VectorCopy(newimpactplane, trace->plane.normal);
trace->plane.dist = newimpactplane[3];
- if (trace->startdepth < startdepth)
+ if (trace->startdepth > startdepth)
{
trace->startdepth = startdepth;
VectorCopy(startdepthnormal, trace->startdepthnormal);
vec4_t endplane;
vec4_t newimpactplane;
texture_t *hittexture = NULL;
- vec_t startdepth = trace->startdepth;
+ vec_t startdepth = 1;
vec3_t startdepthnormal;
- VectorCopy(trace->startdepthnormal, startdepthnormal);
+ VectorClear(startdepthnormal);
Vector4Clear(newimpactplane);
// Separating Axis Theorem:
//Con_Printf("%c%i: startdist = %f, enddist = %f, startdist / (startdist - enddist) = %f\n", nplane2 != nplane ? 'b' : 'a', nplane2, startdist, enddist, startdist / (startdist - enddist));
// aside from collisions, this is also used for error correction
- if (startdist < 0 && trace->startdepth < startdist)
+ if (startdist < 0 && (startdepth < startdist || startdepth == 1))
{
- trace->startdepth = startdist;
- VectorCopy(startplane, trace->startdepthnormal);
+ startdepth = startdist;
+ VectorCopy(startplane, startdepthnormal);
}
if (startdist > enddist)
trace->allsolid = true;
VectorCopy(newimpactplane, trace->plane.normal);
trace->plane.dist = newimpactplane[3];
- if (trace->startdepth < startdepth)
+ if (trace->startdepth > startdepth)
{
trace->startdepth = startdepth;
VectorCopy(startdepthnormal, trace->startdepthnormal);
cliptrace->startsolid = true;
if (cliptrace->realfraction == 1)
cliptrace->ent = touch;
+ if (cliptrace->startdepth > trace->startdepth)
+ {
+ cliptrace->startdepth = trace->startdepth;
+ VectorCopy(trace->startdepthnormal, cliptrace->startdepthnormal);
+ }
}
// don't set this except on the world, because it can easily confuse
// monsters underwater if there's a bmodel involved in the trace