From 9cd0ec2544d2b6edc047cc9bad45b9c563696431 Mon Sep 17 00:00:00 2001 From: hikerstk Date: Mon, 22 Nov 2010 09:27:12 +0000 Subject: [PATCH] Don't activate zipper if kart is driving backwards (that feels imho better game-play-wise than accelerating the kart backwards). This fixes bug 3114776. Also added some docs to btKart. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6694 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/karts/kart.cpp | 2 +- src/physics/btKart.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index c26f7a440..a293f86b3 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -933,7 +933,7 @@ void Kart::handleZipper(const Material *material, bool play_sound) fade_out_time = m_kart_properties->getZipperFadeOutTime(); } // Ignore a zipper that's activated while braking - if(m_controls.m_brake) return; + if(m_controls.m_brake || m_speed<0) return; MaxSpeed::increaseMaxSpeed(MaxSpeed::MS_INCREASE_ZIPPER, max_speed_increase, duration, fade_out_time); diff --git a/src/physics/btKart.cpp b/src/physics/btKart.cpp index 0725fb0f9..98d442f4b 100644 --- a/src/physics/btKart.cpp +++ b/src/physics/btKart.cpp @@ -684,6 +684,9 @@ void btKart::updateFriction(btScalar timeStep) { if (wheel==2 || wheel==3) { + // The zipper velocity is the speed that should be + // reached. So compute the impulse to accelerate the + // kart up to that speed: m_forwardImpulse[wheel] = 0.5f*(m_zipper_velocity - getRigidBody()->getLinearVelocity().length()) / m_chassisBody->getInvMass(); } }