]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
q3df compat: handle the z component correctly in trigger_push_velocity
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Sat, 28 Jan 2023 14:35:33 +0000 (15:35 +0100)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Sat, 28 Jan 2023 14:35:33 +0000 (15:35 +0100)
qcsrc/common/mapobjects/trigger/jumppads.qc

index 28b4ea0554879f5719db7b27fbebd199677dd8a7..17d1d57da5fe657a0a49abee0672d39c0c503bf1 100644 (file)
@@ -132,7 +132,8 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht, entity p
 vector trigger_push_velocity_calculatevelocity(entity this, vector org, entity tgt, float speed, float count, entity pushed_entity, bool is_pushed)
 {
        vector sdir = normalize(vec2(pushed_entity.velocity));
-       float zdir = copysign(1, pushed_entity.velocity.z);
+       float zdir = pushed_entity.velocity.z;
+       if(zdir != 0) zdir = copysign(1, pushed_entity.velocity.z);
 
        vector vs_tgt = '0 0 0';
        float vz_tgt = 0;
@@ -142,6 +143,7 @@ vector trigger_push_velocity_calculatevelocity(entity this, vector org, entity t
                vs_tgt = vec2(vel_tgt);
                vz_tgt = vel_tgt.z;
 
+               // bidirectional jump pads do not play nicely with xonotic's jump pad targets
                if (this.spawnflags & BIDIRECTIONAL_XY)
                {
                        if (normalize(vs_tgt) * sdir < 0)