From: terencehill Date: Tue, 18 Apr 2017 10:41:39 +0000 (+0200) Subject: Correct estimation of time needed to reach jumppad destination; it was easier than... X-Git-Tag: xonotic-v0.8.5~2378^2~181 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=99f5a09ee28e82465dad4c50e67b52f97887018e;p=xonotic%2Fxonotic-data.pk3dir.git Correct estimation of time needed to reach jumppad destination; it was easier than I thought :) --- diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index 7e0886212..d37f72788 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -304,11 +304,13 @@ void trigger_push_findtarget(entity this) e.velocity = trigger_push_calculatevelocity(org, t, this.height); vector best_target = '0 0 0'; vector best_org = '0 0 0'; + vector best_vel = '0 0 0'; bool valid_best_target = false; if (trigger_push_testorigin(e, t, this, org)) { best_target = trace_endpos; best_org = org; + best_vel = e.velocity; valid_best_target = true; } @@ -327,6 +329,7 @@ void trigger_push_findtarget(entity this) { best_target = trace_endpos; best_org = new_org; + best_vel = e.velocity; valid_best_target = true; } new_org = org - ofs; @@ -335,11 +338,16 @@ void trigger_push_findtarget(entity this) { best_target = trace_endpos; best_org = new_org; + best_vel = e.velocity; valid_best_target = true; } } if (valid_best_target) - waypoint_spawnforteleporter(this, best_target, (vlen(t.origin - best_org) + vlen(best_target - t.origin)) / vlen(e.velocity)); + { + float distxy = (vlen((best_target - eZ * best_target.z) - (best_org - eZ * best_org.z))); + float velxy = vlen(best_vel - eZ * best_vel.z); + waypoint_spawnforteleporter(this, best_target, distxy / velxy); + } delete(e); #endif }