]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Adjust jump pad velocity on Q3 maps to match 125fps frametime-dependent behaviour
authorbones_was_here <bones_was_here@xonotic.au>
Thu, 16 Feb 2023 18:21:48 +0000 (04:21 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 17 Feb 2023 07:41:10 +0000 (17:41 +1000)
qcsrc/common/mapobjects/trigger/jumppads.qc

index ecc80f4ad668e1f695542196bc8b0b3760c3a5a3..4754213bf3dd6e37efd961219ed9e44cb66c91a2 100644 (file)
@@ -39,6 +39,14 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht, entity p
        if(pushed_entity && pushed_entity.gravity)
                grav *= pushed_entity.gravity;
 
+       // Q3 has frametime-dependent gravity, but its trigger_push velocity calculation doesn't account for that.
+       // This discrepancy can be simulated accurately which ensures that all entities will arrive
+       // where they would in Q3 with gravity 800 at 125fps, even if entity-specific gravity is applied.
+       // This can be hard-coded because we don't support the Q3 world.gravity field at this time.
+       // See physicsCPMA.cfg for maths and test results.
+       if (Q3COMPAT_COMMON)
+               grav /= 750/800; // exact float, unlike 800/750
+
        zdist = torg.z - org.z;
        sdist = vlen(torg - org - zdist * '0 0 1');
        sdir = normalize(torg - org - zdist * '0 0 1');