]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
entity unsticking: verify if the new position REALLY is not in solid (should hide...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 13 Apr 2009 10:16:49 +0000 (10:16 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 13 Apr 2009 10:16:49 +0000 (10:16 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8920 d7cf8633-e32d-0410-b094-e92efae38249

sv_phys.c

index 6a6dda8c68383f6e84c4159f86ab708f39ec65de..fd1b825199d91968dd2e7c882c1140e25ecaef1c 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -519,7 +519,20 @@ static int SV_TestEntityPosition (prvm_edict_t *ent, vec3_t offset)
        }
        // if the trace found a better position for the entity, move it there
        if (VectorDistance2(trace.endpos, ent->fields.server->origin) >= 0.0001)
+       {
+#if 0
+               // please switch back to this code when trace.endpos sometimes being in solid bug is fixed
                VectorCopy(trace.endpos, ent->fields.server->origin);
+#else
+               // verify if the endpos is REALLY outside solid
+               VectorCopy(trace.endpos, org);
+               trace = SV_Move (org, ent->fields.server->mins, ent->fields.server->maxs, org, MOVE_NOMONSTERS, ent, SUPERCONTENTS_SOLID);
+               if(trace.startsolid)
+                       Con_Printf("SV_TestEntityPosition: trace.endpos detected to be in solid. NOT using it.\n");
+               else
+                       VectorCopy(org, ent->fields.server->origin);
+#endif
+       }
        return false;
 }