cvar_t collision_endnudge = {0, "collision_endnudge", "0", "how much to bias collision trace end"};
cvar_t collision_enternudge = {0, "collision_enternudge", "0", "how much to bias collision entry fraction"};
cvar_t collision_leavenudge = {0, "collision_leavenudge", "0", "how much to bias collision exit fraction"};
+cvar_t collision_prefernudgedfraction = {0, "collision_prefernudgedfraction", "1", "whether to sort collision events by nudged fraction (1) or real fraction (0)"};
void Collision_Init (void)
{
Cvar_RegisterVariable(&collision_endnudge);
Cvar_RegisterVariable(&collision_enternudge);
Cvar_RegisterVariable(&collision_leavenudge);
+ Cvar_RegisterVariable(&collision_prefernudgedfraction);
}
trace->hittexture = hittexture;
trace->realfraction = bound(0, enterfrac, 1);
trace->fraction = bound(0, enterfrac2, 1);
+ if (collision_prefernudgedfraction.integer)
+ trace->realfraction = trace->fraction;
VectorCopy(newimpactnormal, trace->plane.normal);
}
else
trace->hittexture = hittexture;
trace->realfraction = bound(0, enterfrac, 1);
trace->fraction = bound(0, enterfrac2, 1);
+ if (collision_prefernudgedfraction.integer)
+ trace->realfraction = trace->fraction;
VectorCopy(newimpactnormal, trace->plane.normal);
}
else
// (the main fraction remains perfect)
trace->fraction = f - collision_impactnudge.value * d;
+ if (collision_prefernudgedfraction.integer)
+ trace->realfraction = trace->fraction;
+
// store the new trace plane (because collisions only happen from
// the front this is always simply the triangle normal, never flipped)
d = 1.0 / sqrt(faceplanenormallength2);
#define HULLCHECKSTATE_SOLID 1
#define HULLCHECKSTATE_DONE 2
+extern cvar_t collision_prefernudgedfraction;
static int Mod_Q1BSP_RecursiveHullCheck(RecursiveHullCheckTraceInfo_t *t, int num, double p1f, double p2f, double p1[3], double p2[3])
{
// status variables, these don't need to be saved on the stack when
midf = (t1 - DIST_EPSILON) / (t1 - t2);
t->trace->fraction = bound(0, midf, 1);
+ if (collision_prefernudgedfraction.integer)
+ t->trace->realfraction = t->trace->fraction;
+
#if COLLISIONPARANOID >= 3
Con_Print("D");
#endif