From f1faa5ba78be11cd1deeef6446be077a1f3612be Mon Sep 17 00:00:00 2001 From: codemob-dev <69110900+codemob-dev@users.noreply.github.com> Date: Sat, 26 Jul 2025 10:53:02 -0400 Subject: [PATCH] Decrease bounciness to make bouncing smoother. --- src/game.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/game.zig b/src/game.zig index 00ae7be2..1ff41a4b 100644 --- a/src/game.zig +++ b/src/game.zig @@ -1282,7 +1282,10 @@ pub fn update(deltaTime: f64) void { // MARK: update() bounciness *= 0.5; } var velocityChange: f64 = undefined; - if(bounciness != 0.0 and Player.super.vel[2] < -3.0) { + // Smoothly decrease bounciness + // https://www.desmos.com/calculator/qn52dl3qto + bounciness *= @floatCast(1 - 1/(Player.super.vel[2]*Player.super.vel[2] + 1)); + if(bounciness != 0.0 and Player.super.vel[2] < -0.1) { velocityChange = Player.super.vel[2]*@as(f64, @floatCast(1 - bounciness)); Player.super.vel[2] = -Player.super.vel[2]*bounciness; Player.jumpCoyote = Player.jumpCoyoteTimeConstant + deltaTime;