From ffb5bb57f80db3fb30e8cae92dc15df043deb629 Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Sat, 15 Jun 2019 17:45:05 +0200 Subject: [PATCH] Push entitie slightly away from non horizontal surfaces. Otherwise the entities origin might be in the surface, which causes it to be rendered in full black. --- src/g_phys.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/g_phys.c b/src/g_phys.c index fecf28b..b3be126 100644 --- a/src/g_phys.c +++ b/src/g_phys.c @@ -530,6 +530,14 @@ retry: VectorCopy(trace.endpos, ent->s.origin); gi.linkentity(ent); + /* Push slightly away from non-horizontal surfaces, + prevent origin stuck in the plane which causes + the entity to be rendered in full black. */ + if (trace.plane.type != 2) + { + VectorAdd(ent->s.origin, trace.plane.normal, ent->s.origin); + } + if (trace.fraction != 1.0) { SV_Impact(ent, &trace);