From 6cf6306b966f780cb57328a8ccbae7529e633cb5 Mon Sep 17 00:00:00 2001 From: Paul Mathieu Date: Thu, 16 Dec 2021 14:10:23 -0800 Subject: [PATCH] Tweak jumping --- index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 0835ae8..91352d4 100644 --- a/index.js +++ b/index.js @@ -147,8 +147,9 @@ function handleKeys(params) { params.camera.position[1] += 0.1; } else { if (params.jumpAmount > 0) { - params.camera.velocity[1] = 5.0 / 60; - params.jumpAmount -= 5.0; + const amount = 0.4 * params.jumpAmount; + params.camera.velocity[1] += amount / 60; + params.jumpAmount -= amount; } } return; @@ -190,7 +191,7 @@ function updatePhysics(params) { params.camera.position = newPos; params.camera.velocity = newPos.map((v, i) => v - oldPos[i]); if (isOnGround) { - params.jumpAmount = 20; + params.jumpAmount = 6; params.camera.velocity = params.camera.velocity.map(v => v * 0.7); } params.isOnGround = isOnGround;