]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/ecs/systems/physics.qc
Improve physics in water when frozen
[xonotic/xonotic-data.pk3dir.git] / qcsrc / ecs / systems / physics.qc
index fb0781e49e527391914ce6bc924e29eab822b2e4..75657c90f268c6f9248377114df942c96fbf1674 100644 (file)
@@ -220,8 +220,10 @@ void sys_phys_simulate(entity this, float dt)
        if (this.com_phys_water) {
                if (PHYS_FROZEN(this))
                {
-                       if(this.waterlevel >= WATERLEVEL_SUBMERGED)
+                       if(this.waterlevel >= WATERLEVEL_SUBMERGED && this.velocity.z >= -70) // don't change the speed too abruptally
                                wishvel = '0 0 160'; // resurface
+                       else if(this.waterlevel >= WATERLEVEL_SWIMMING && this.velocity.z > 0)
+                               wishvel = eZ * 1.3 * min(this.velocity.z, 160); // resurface a bit more above the surface
                }
                else
                {