From 616c8184d093615f0bcca57117115141fd28d953 Mon Sep 17 00:00:00 2001 From: Catalin Constantin Mititiuc Date: Sat, 17 Jan 2026 15:23:59 -0800 Subject: [PATCH] Add limit for angular velocity --- html/images/space.svg | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/html/images/space.svg b/html/images/space.svg index d6408e8..7ec879e 100644 --- a/html/images/space.svg +++ b/html/images/space.svg @@ -813,10 +813,13 @@ function updateShip(s, elapsed) { s.angularVelocity = angularVel + angularAcc; const friction = 0.05; + const limit = 3; if (s.angularVelocity > 0) { + if (s.angularVelocity > limit) s.angularVelocity = limit; s.angularVelocity -= s.angularVelocity > friction ? friction : s.angularVelocity; } else if (s.angularVelocity < 0) { + if (s.angularVelocity < -limit) s.angularVelocity = -limit; s.angularVelocity += -s.angularVelocity > friction ? friction : -s.angularVelocity; } @@ -845,7 +848,7 @@ function updateShip(s, elapsed) { // s.collision = detectCollision([px, py], p, s.velocity, tempRadius, map); s.collision = detectCollision([px, py], p, s.velocity, s.radius, map, s.gearDown); - if (s.collision) console.log("COLLISION", s.collision); + if (!current && s.collision) console.log("COLLISION", s.collision); legs.style.display = s.gearDown ? "initial" : "none";