cvar_t collision_impactnudge = {0, "collision_impactnudge", "0.03125", "how much to back off from the impact"};
cvar_t collision_startnudge = {0, "collision_startnudge", "0", "how much to bias collision trace start"};
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_enternudge = {0, "collision_enternudge", "0.03125", "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)"};
if (d1 > d2)
{
// moving into brush
- if (d2 > 0)
+ if (d2 >= collision_enternudge.value)
return;
if (d1 > 0)
{
// enter
imove = 1 / (d1 - d2);
f = (d1 - collision_enternudge.value) * imove;
+ if (f < 0)
+ f = 0;
// check if this will reduce the collision time range
if (enterfrac < f)
{
return;
// calculate the nudged fraction and impact normal we'll
// need if we accept this collision later
- enterfrac2 = f - collision_impactnudge.value * imove;
+ enterfrac2 = (d1 - collision_impactnudge.value) * imove;
VectorLerp(startplane->normal, enterfrac, endplane->normal, newimpactnormal);
hitq3surfaceflags = startplane->q3surfaceflags;
hittexture = startplane->texture;
{
// leave
f = (d1 + collision_leavenudge.value) / (d1 - d2);
+ if (f > 1)
+ f = 1;
// check if this will reduce the collision time range
if (leavefrac > f)
{
if (d1 > d2)
{
// moving into brush
- if (d2 > 0)
+ if (d2 >= collision_enternudge.value)
return;
if (d1 > 0)
{
// enter
imove = 1 / (d1 - d2);
f = (d1 - collision_enternudge.value) * imove;
+ if (f < 0)
+ f = 0;
// check if this will reduce the collision time range
if (enterfrac < f)
{
return;
// calculate the nudged fraction and impact normal we'll
// need if we accept this collision later
- enterfrac2 = f - collision_impactnudge.value * imove;
+ enterfrac2 = (d1 - collision_impactnudge.value) * imove;
VectorLerp(startplane->normal, enterfrac, endplane->normal, newimpactnormal);
hitq3surfaceflags = startplane->q3surfaceflags;
hittexture = startplane->texture;