]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Improve destination waypoint generation of jumppads with a high horizontal push....
authorterencehill <piuntn@gmail.com>
Sun, 31 Dec 2017 17:06:55 +0000 (18:06 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 31 Dec 2017 17:06:55 +0000 (18:06 +0100)
qcsrc/common/triggers/trigger/jumppads.qc

index d10a1e33037d69ae81b22943c8ab26ed8e5ffe63..dc9cb761ab2cf18b7f0d02f9f9a2b24c49e1c693 100644 (file)
@@ -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)
        {