From 996b4fa4f78dcd5d4545a543b0ecc7b53b309c80 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sun, 31 Dec 2017 18:06:55 +0100 Subject: [PATCH] Improve destination waypoint generation of jumppads with a high horizontal push. It fixes jumppad to jumppad to strength and jumppad to vortex in the map The Yard --- qcsrc/common/triggers/trigger/jumppads.qc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index d10a1e330..dc9cb761a 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -278,23 +278,27 @@ bool trigger_push_testorigin(entity tracetest_ent, entity targ, entity jp, vecto if(trace_startsolid) return false; - if(!jp.height) + if (!jp.height) { // since tracetoss starting from jumppad's origin often fails when target // is very close to real destination, start it directly from target's // origin instead + vector ofs = '0 0 0'; + if (vdist(vec2(tracetest_ent.velocity), <, autocvar_sv_maxspeed)) + ofs = stepheightvec; + tracetest_ent.velocity.z = 0; - setorigin(tracetest_ent, targ.origin + stepheightvec); + setorigin(tracetest_ent, targ.origin + ofs); tracetoss(tracetest_ent, tracetest_ent); - if(trace_startsolid) + if (trace_startsolid && ofs.z) { - setorigin(tracetest_ent, targ.origin + stepheightvec / 2); + setorigin(tracetest_ent, targ.origin + ofs / 2); tracetoss(tracetest_ent, tracetest_ent); - if(trace_startsolid) + if (trace_startsolid && ofs.z) { setorigin(tracetest_ent, targ.origin); tracetoss(tracetest_ent, tracetest_ent); - if(trace_startsolid) + if (trace_startsolid) return false; } } @@ -307,7 +311,7 @@ void trigger_push_findtarget(entity this) { // first calculate a typical start point for the jump vector org = (this.absmin + this.absmax) * 0.5; - org.z = this.absmax.z - PL_MIN_CONST.z; + org.z = this.absmax.z - PL_MIN_CONST.z - 10; if (this.target) { -- 2.39.2